| TCPServer (1.1c) | |
| _Class_TCPServer | Object that simplifiy the creation of Encrypted, multi-clients TCP Server. |
| Properties | |
| ip | IP Address to listen |
| port | Port number to listen |
| max_recv_len | max # of characters to receive (TCPRecv) |
| Timeout | Receiving timeout (in ms). |
| Callback_NewClient | Function called when a new client connects to the server. |
| Callback_LostClient | Function called when a client disconnects from the server. |
| Callback_Recv | Function that is called when data (Binary/String) is received from a client |
| Callback_Receiving | Function that is called when being receiving data from a client |
| Callback_Timedout | Function that is called when a client is timed out |
| Functions | |
| _Class_TCPServer | Class constructor |
| Startup | Starts the server. |
| Shutdown | Disconnect all clients, and shutdown the server |
| Process | Function that calls all the server callbacks when events occures (New client, Receiving...) |
| Send | Send data (Binary/String) to a client |
| Broadcast | Send data to all connected clients |
| Disconnect | Disconnect a specified client |
| DisconnectAll | Disconnect all connected clients. |
| NbrClients | Return the total number of connected clients. |
| SocketIDList | Return a 1-based array of all currently connected client’s socket ID |
| SocketID2IP | Return the IP of a given client’s socket |
| IP2SocketID | Return the socket ID of a given client’s IP |
| SocketID2hSocket | Return the Socket Handle of a client’s Socket ID |
| ClientPropertySet | Set an extended property of a client to a specified value |
| ClientPropertyGet | Get the value of a client’s extended property |
| ClientGetBufferLen | Return the current buffer lenght of a client |
Object that simplifiy the creation of Encrypted, multi-clients TCP Server.
There can be only ONE server per script.
| Properties | |
| ip | IP Address to listen |
| port | Port number to listen |
| max_recv_len | max # of characters to receive (TCPRecv) |
| Timeout | Receiving timeout (in ms). |
| Callback_NewClient | Function called when a new client connects to the server. |
| Callback_LostClient | Function called when a client disconnects from the server. |
| Callback_Recv | Function that is called when data (Binary/String) is received from a client |
| Callback_Receiving | Function that is called when being receiving data from a client |
| Callback_Timedout | Function that is called when a client is timed out |
| Functions | |
| _Class_TCPServer | Class constructor |
| Startup | Starts the server. |
| Shutdown | Disconnect all clients, and shutdown the server |
| Process | Function that calls all the server callbacks when events occures (New client, Receiving...) |
| Send | Send data (Binary/String) to a client |
| Broadcast | Send data to all connected clients |
| Disconnect | Disconnect a specified client |
| DisconnectAll | Disconnect all connected clients. |
| NbrClients | Return the total number of connected clients. |
| SocketIDList | Return a 1-based array of all currently connected client’s socket ID |
| SocketID2IP | Return the IP of a given client’s socket |
| IP2SocketID | Return the socket ID of a given client’s IP |
| SocketID2hSocket | Return the Socket Handle of a client’s Socket ID |
| ClientPropertySet | Set an extended property of a client to a specified value |
| ClientPropertyGet | Get the value of a client’s extended property |
| ClientGetBufferLen | Return the current buffer lenght of a client |
Function that is called when being receiving data from a client
_Func($iSocket, $sIP, $BufferLenght)
| $iSocket | Socket ID of the client |
| $sIP | IP Adress of the client |
| $BufferLenght | Lenght of the client’s receiving buffer (Not equal to the final lenght/size of the received data, it’s just an indication) |
Function that is called when a client is timed out
_Func($iSocket, $sIP, $BufferLenght_LostData)
| $iSocket | Socket ID of the client |
| $sIP | IP Adress of the client |
| $BufferLenght_LostData | Lenght of the buffer when timed out, corresponds to the amount of lost data (because buffer is flushed when time out occures) |
Class constructor
| $ip | Value to assign to ip |
| $port | Value to assign to port |
| $max_clients | Maximum number of clients at the same time |
| $Ext_Info_Nbr | Number of extended data that can be associated with each client (see ClientPropertySet & ClientPropertyGet) |
| $encrypt_pwd | Data encryption password. Must be the same as in the clients. |
Starts the server.
| $cb_NewClient | Value to assign to Callback_NewClient |
| $cb_LostClient | Value to assign to Callback_LostClient |
| $cb_Recv | Value to assign to Callback_Recv |
| $cb_Receiving | Value to assign to Callback_Receiving |
| $cb_Timedout | Value to assign to Callback_Timedout |
| Success | Returns main socket identifier. |
| Failure | Returns 0 and set @error to: |
windows API WSAGetError return value (see MSDN).
Send data to all connected clients
| $s_bData | Data to be sent (Binary/String) |
| Success | Number of clients that data was sent to them successfully, @extended = Percentage of succes (Return value / Total number of clients) |
| Failure | 0 and |
@error = 1 -> Server not started @error = 2 -> No any client received data