the following is part of a socket class that im working on. what i am stuck with is in serverEndAccept i would like to pass/return a string indicating the accept has been successful. for these am i to use delegates? also by declaring delegates would it not breach the application Model isolation? i.e. i need this to be an independent class which could be used by future separate. im sure there is a sane solution to this but being a newcomer to programming, its beyond me at the moment, so i am asking.
thanks.
public void serverBeginAceept(int serverPort)
{
mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Any, serverPort);
mainSocket.Bind(ipEndPoint);
mainSocket.Listen(MAX_CONNECTIONS);
mainSocket.BeginAccept(new AsyncCallback(serverEndAccept), mainSocket);
}
public void serverEndAccept(IAsyncResult iar)
{
Socket oldServer = (Socket)iar.AsyncState;
mainSocket = oldServer.EndAccept(iar);
}
i guess i could get these methods to return a string! maybe thats the best bet.