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.
- If the client computer is using 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.
Reminder: A socket is a communication resource used by the applications to communicate between computers regardless of the network type.
// Creates a socket on the server
IF SocketCreate("Server", 8000) = False THEN
Error("Creation error " + ErrorInfo(errMessage))
// Manage the connections of the client computers in a thread
ThreadExecute("Thread1", threadNormal, WaitProcedure)
IF SocketWaitForConnection("Server") = True 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)
<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 the details of the error, use ErrorInfo.
<Socket name>: Character string (with quotes)
Name of the server socket that accepts the connection.
Caution: The socket name is case sensitive.
The communication channel opened by SocketAccept
must be closed by SocketClose