Events: |
OnError(Description) |
This will return fatal error messages. |
OnWarning(Description) |
This will return non-fatal error messages (warnings). |
OnConnect(Index, IsLast) |
Every incomming connection will be accepted and reported using
this event. When the connection buffer is full, the IsLast flag
will be set to true. The server can then tell the client it's
too busy and then close the connection using 'Close Index'.
Also the GetInfo method can be used to determine the address and
port from which the client made its connection. If the IP is
invalid, the 'Close Index' method may also be used to reject the
client.
|
OnReceive(Index, Message, Length) |
Every message (binary or ASCII) will be returned using this event.
The message (null terminated for ASCII) will be stored in the byte
string 'Message', for both types the length of the message is returned.
In case of an ASCII message the carriage return and linefeed will be
discarded. Every line is recognized by its linefeed.
|
OnClose(Index) |
When a client has closed the connection, the OnClose event is raised.
The GetInfo method may still be used to determine the origin of the client
for fancy logging :-)
|
Methods: |
Bind [Port] |
To make the server bind the socket and listen for incomming connections,
this method must be called. Optionaly a Port may be specified. The port
can also be set using the Port property.
|
UnBind |
This method may be used to shut the server down. It's not necesery to close
the client connections prior to calling this method. But if you want to be
nice to your clients, you will tell them the server will go down :-)
|
GetInfo(Index, Host, Port) |
Call this function with a valid index and a pre-allocated Host and Port variable.
After the call the Host and Port variables will contain the source address of the
client.
|
IsConnected |
Use this method to check wether or not a client is connected. |
bytesReceived(Index) |
A counter for the total amount of bytes received from a specific client. |
bytesSend(Index) |
A counter for the total bytes send to a specific client. |
Close(Index) |
This method closes the connection to a client. |
Properties: |
Port |
Use this to set the port which the server has to listen to. It's exactly the
same as calling Bind with an argument.
|
Binary |
Set to true, the server enters binary mode and will pass the data exactly
as it is. Set to false, the server enters ASCII mode and will pass lines
of data, split over linefeeds (\n 0xA). Carriage (\r 0xD) returns will be discarded.
|