AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / Sockets
  • Communication channel
  • Required permissions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Run on the server, this function accepts a request for connecting to an existing socket found on the server. This function is used to create the communication channel between the server socket and the client socket.
This allows you to create a different communication channel for each client computer. Each one of these communication channels can be handled in an independent thread.
Remarks:
  • If the client computer uses a WINDEV application to connect to this socket, this application will have to use SocketConnect.
  • SocketAccept can be used with the SSL sockets.
  • SocketAccept cannot be used with a UDP socket.
WEBDEV - Server code To use sockets on the server workstation, you need to check the "Allow server sockets" option in the "Advanced" tab of the WEBDEV administrator.
Reminder A socket is a communication resource used by applications to communicate from one machine to another, regardless of the type of network.
Example
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)PHPAjax
// Crée un socket sur le poste serveur
IF SocketCreate("Serveur", 8000) = False THEN
	Error("Erreur de création " + ErrorInfo(errMessage))
ELSE
	// Gestion des connexions des postes clients dans un thread
	ThreadExecute("Thread1", threadNormal, ProcédureAttente)
END
// ------------------------------------------------------
PROCEDURE ProcédureAttente()
LOOP
	IF SocketWaitForConnection("Serveur") = True THEN
		Canal is string
		// Si la connexion est acceptée, 
		// la gestion de cette connexion est réalisée dans un thread spécifique
		Canal = SocketAccept("Serveur")
		ThreadExecute(Canal, threadNormal, ProcédureGestion, Canal)
	END
END
Syntax
<Result> = SocketAccept(<Socket name>)
<Result>: Character string
  • Name of the communication channel to the client socket that requested the connection. This name will be used by all the other Socket functions to specify this communication channel.
  • Empty string ("") if an error occurred. To get more details on the error, use ErrorInfo.
<Socket name>: Character string
Name of the server socket that accepts the connection.
WINDEV Warning: The socket name is "case-sensitive".
Remarks

Communication channel

The communication channel opened by SocketAccept must be closed by SocketClose.
AndroidAndroid Widget

Required permissions

This function changes the permissions required by the application.
Required permission: INTERNET
This permission allows the applications to open the network sockets.
Component: wd300com.dll
Versión mínima requerida
  • Versión 9
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 02/04/2025

Señalar un error o enviar una sugerencia | Ayuda local