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
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Run on the server, this function is used to wait for a connection request coming from the client sockets.
Remarks:
  • If the client computer uses a WINDEV application to connect to this socket, the connection request is performed by SocketConnect.
  • UDP-type socket type: The function SocketWaitForConnection function cannot be used with UDP-type sockets.
Reminder A socket is a communication resource used by applications to communicate from one machine to another, regardless of the type of network.
Ejemplo
WINDEVCódigo de Usuario (UMC)
// Creates a socket on the server
IF SocketCreate("Server", 8000) = False THEN
Error("Creation error " + ErrorInfo(errMessage))
ELSE
// Manage the connections of the client computers in a thread
ThreadExecute("Thread1", threadNormal, WaitProcedure)
END
 
 
INTERNAL PROCEDURE WaitProcedure()
IF SocketWaitForConnection("Server") THEN
Channel is string
// If the connection is accepted,
// this connection is managed in a specific thread
Channel = SocketAccept("Server")
ThreadExecute(Channel, threadNormal, ProcedureManagement, Channel)
ELSE
IF NOT SocketExist("Server") THEN
        BREAK
END
END
END
Sintaxis
<Result> = SocketWaitForConnection(<Socket name> [, <Maximum timeout>])
<Result>: Boolean
  • True A new connection request is pending.
  • False no connection request has been detected.
<Socket name>: Character string
Name of the server socket that waits for the connection.
WINDEV Warning: The socket name is "case-sensitive".
<Maximum timeout>: Optional integer or optional Duration
Maximum timeout (in milliseconds).
  • This function is a blocking function during the specified duration or until a connection request is detected.
  • If this parameter is not specified, the function locks the application until the next attempt to connect.
Note if this function is used in a multi-threaded environment, the function only blocks the thread in which it is called.
This parameter can correspond to:
  • an integer representing the number of milliseconds,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
Observaciones
Componente: wd300com.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
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