The IO Exception: "Unable to read data from the transport connection: An established connection was aborted by the software in your host machine."
The code has been copied from a tutorial and I'm sure that this error has something to do with my own machine. All of my firewalls, ESET and Windows, are off. The clients connect via port 55555.
edit:
Client
static void Main(string[] args)
{
MakeClientCallToServer("test");
MakeClientCallToServer("test2");
MakeClientCallToServer("test3");
// Now send a bunch of messages...
string msg;
for (int i = 0; i < 100; i++)
{
msg = string.Format(Thread.CurrentThread.CurrentCulture,
"I'll not be ignored! (round {0})", i);
ThreadPool.QueueUserWorkItem(new
WaitCallback(MakeClientCallToServer), msg);
}
Console.WriteLine("\n Press any key to continue... ");
Console.Read();
}
static void MakeClientCallToServer(object objMsg)
{
string msg = (string)objMsg;
MyTcpClient client = new MyTcpClient(IPAddress.Loopback, 55555);
client.ConnectToServer(msg);
}
Server
static MyTcpServer server;
static void Main(string[] args)
{
ThreadPool.QueueUserWorkItem(RunServer);
Console.WriteLine("Press esc to stop the server...");
ConsoleKeyInfo cki;
while (true)
{
cki = Console.ReadKey();
if (cki.Key == ConsoleKey.Escape)
{
break;
}
}
}
static void RunServer(object stateInfo)
{
//Initiate the server)
server = new MyTcpServer(IPAddress.Loopback, 55555);
server.Listen();
}
I've already made classes named MyTcpServer and MyTcpClient to handle all of the common connections, threading, etc.