D
Dan Holmes
The first tim ethis app is run it works just fine as well as every
restart. What i can't figure is how to get it to accept a connection
after the first one.
This is a console app but i don't think that matters.
using SNS = System.Net.Sockets;
......
SNS.TcpListener listn = new SNS.TcpListener(System.Net.IPAddress.Any,
20000);
listn.Start();
IAsyncResult ar = listn.BeginAcceptTcpClient(new
AsyncCallback(ProcessSocket), listn);
.....
static void ProcessSocket(IAsyncResult ar)
{
// Get the listener that handles the client request.
SNS.TcpListener listener = (SNS.TcpListener)ar.AsyncState;
SNS.TcpClient clientSocket = listener.EndAcceptTcpClient(ar);
Console.WriteLine("Client connected completed");
UpdateAndRestart();
clientSocket.Close();
listener.Stop();
listener.Start();
}
restart. What i can't figure is how to get it to accept a connection
after the first one.
This is a console app but i don't think that matters.
using SNS = System.Net.Sockets;
......
SNS.TcpListener listn = new SNS.TcpListener(System.Net.IPAddress.Any,
20000);
listn.Start();
IAsyncResult ar = listn.BeginAcceptTcpClient(new
AsyncCallback(ProcessSocket), listn);
.....
static void ProcessSocket(IAsyncResult ar)
{
// Get the listener that handles the client request.
SNS.TcpListener listener = (SNS.TcpListener)ar.AsyncState;
SNS.TcpClient clientSocket = listener.EndAcceptTcpClient(ar);
Console.WriteLine("Client connected completed");
UpdateAndRestart();
clientSocket.Close();
listener.Stop();
listener.Start();
}