ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / Sockets
  • Required permissions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
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 socket: SocketWaitForConnection cannot be used with UDP sockets.
WEBDEV - Server code To use the sockets on the server, check "Allow server sockets" in the "Advanced" tab of the WEBDEV administrator.
Reminder: A socket is a communication resource used by applications to communicate from one computer to another regardless of the type of network.
Example
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)PHPAjax
// 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
Syntax
<Result> = SocketWaitForConnection(<Socket name> [, <Maximum timeout>])
<Result>: Boolean
  • True: a new request for connection is pending.
  • False: no request for connection was detected.
<Socket name>: Character string
Name of the server socket that waits for the connection.
WINDEV Caution: 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.
Remark: if this function is used in multi-thread mode, the function only locks the thread in which it is called.
This parameter can be:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
Remarks
AndroidAndroid Widget

Required permissions

The call to this function modifies the permissions required by the application.
Required permission : INTERNET
This permission allows the applications to open the network sockets.
Component: wd290com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help