Quick Start

I Start a server

1 .Create listener

To create a listener use class Acceptor:
Acceptor acp = new Acceptor(8888);
the parameter '8888' set listener accept socket on port 8888.

2 .Implements listener's event function

The event Accepted must be implement.

acp.Accepted = (sock,id,buffersize) =>
{
//To do: use socket instance to recive and send data
};
3 .Start receive data

In Accepted event function,create AsyncSocket's instance use the accepted socket
acp.Accepted = (sock,id,buffersize) =>
{
AsyncSocket sk = new AsyncSocket(sock, buffersize);
sk.ID = id;
sk.WaitReceive(); //this will start to read data from connection
};



Last edited Nov 5, 2009 at 1:39 PM by ipconfiger, version 2

Comments

No comments yet.