MySock 2.01b

TSock is an abstract class only used for inheriting with support for an Handle. The only procedure it declares in the public section is ProcessMessages. With ProcessMessages you can process all windows messages that are send to the Handle of this object.
TSOCK is originally by Beach Dog Software. New versions can be downloaded at http://cajsoft.cjb.net.

TClientSock

procedures/properties:
- Function Open : Boolean;
Open an connection to host Hostname at port portname.

Procedure Abort;
Aborts the connection (fast).

Function Close : Boolean;
Close the connection.

Function Send(Value : String) : Boolean;
Send a string to the server (must be connected).

Function ReceiveCount(Count : Integer) : String;
Receive count bytes from server (must be connected).

Function Receive : String;
Receive string from server (must be connected).

Function HostLookup(Value : String) : TInAddr;
Lookup a host.

Function PortLookup(Value : String) : U_Short;
Lookup a port.

Property Text : String;
Reading from text receives data from the socket. Writing to Text sends text to the socket.

Property Connected : Boolean;
Are we connected?

Property Socket : TSocket;
The socket handle.

Property RemoteHost : String;
The host we are connected to.


Property HostName : String;
The hostname we want to connect to.
Property PortName : String
The post we want to connect to.
Property Blocking : Boolean
Set to true for a blocked connection.
Property BlockingTimeout : Integer
Blocking timeout.

Events:

Property OnConnect : TNotifyEvent
Occurs when connected.

Property OnDisconnect : TNotifyEvent
Occurs when the remote host disconnects.

Property OnRead : TNotifyReadEvent
Occurs when there is data avialable.

Property OnWrite : TNotifyEvent
Occurs when data is send.

TClientSockServ

TClientSockServ is inherited from TClientSock. This class hides the events. TClientSockServ is used when a client connects to your server socket.

property MustClose : Boolean
You should check this often, it is set when the server socket is going to be closed.

property ServerSock : TCustomServerSock
The server socket.

There are two kind of server sockets:
TBlockingServerSock and TNonBlockingServerSock. The blocking server opens threads when a used is connected. The other doesn't.

TBlockingServerSock



Property OnAutoAccept : TNotifyAutoEvent;
Occurs when an client connects. This event handler should be thread-safe.

Property Active : Boolean;
Set to true set activate the server.

Property PortName : String;
Set the port this server is assigned to.

Property MaxClient : Integer;
Set the maximum number of clients.

Property OnMaxClient : TNotifyMaxClientEvent;
Occurs when the maximum of clients is connected.

TNonBlockingServerSock

Property Active : Boolean;
Set to true set activate the server.

Property PortName : String;
Set the port this server is assigned to.

Property MaxClient : Integer;
Set the maximum number of clients.

Property OnMaxClient : TNotifyMaxClientEvent;
Occurs when the maximum of clients is connected.

Property OnConnect : TNotifyEvent;
Occurs when a new user is connected.

Property OnDisconnect : TNotifyEvent;
Occurs when an user disconnects.

Property OnWrite : TNotifyEvent;
Occurs when data has been send.

Property OnRead : TNotifyReadEvent;
Occurs when there is data available at TClientSockServer(sender).