Allows the server to get information about the current client socket. The current client socket corresponds to the last socket whose message was read by SocketRead
This function can be used on a server of sockets. This allows you to find out whether a user connected via the socket and to check the validity of connection.
- UDP sockets: Allows the server to get information about the socket whose last message was read by SocketRead.
Reminder: A socket is a communication resource used by applications to communicate from one computer to another regardless of the type of network.
// Add the incoming messages into a table
TableAdd(TABLE_IncomingMsg, "1" + TAB + SocketRead("Server", False) + ...
TAB + SocketClientInfo("server", SocketAddress) + ...
TAB + SocketClientInfo("server", SocketPort))
EDT_SentenceReceivedFromComputerB = SocketRead("ComputerA", False, 2000)
IF EDT_SentenceReceivedFromComputerB <> "" THEN
Info("Message received from IP address # " + SocketClientInfo("ComputerA", SocketAddress))
<Result> = SocketClientInfo(<Socket name> , <Type of Information>)
<Result>: Character string
- Requested information.
- Empty string in case of problem.
<Socket name>: Character string
Name of socket defined on the server. This name was defined by SocketCreate (for a simplified server) or by SocketAccept (for a standard server).
Caution: The socket name is case sensitive.
<Type of Information>: Integer constant
Information to retrieve:
|SocketAddress||IP address of client socket.|
|SocketPort||Port number to which the socket is connected.|
When a server is created on a port, a communication channel is created for each new connected client. This communication channel is using a port, chosen by the system among the available ports. SocketClientInfo returns the port number used by the communication channel.