Big TCP Issue

  • Thread starter Thread starter pigeonrandle
  • Start date Start date
P

pigeonrandle

Hi,
I may tattoo your name on my forehead if you can help me out on this
one!


I'm using the following example code for a client/server 'test'..

Server:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgu...


Client:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgu...


You can paste both into new console apps if you want to join the party.


Now, i run the server, then run the client and get the expected result.


Then i change the client Main() to:

public static int Main(String[] args)
{
Console.ReadLine();
StartClient();
Console.ReadLine();
StartClient();
return 0;
}

and when i press return for the second time, i get an error - somehow
(i think), the first socket does not get closed properly.

BUT, if i have two of the clients running at the same time on the same
(or different machines), they both work once, and then also throw an
error.

If your name is more than 10 characters long, you might want me to use
a shortened version that is more visible from greater distances.

Cheers,
James Randle.
 
Too late i'm afraid people, Barry answered a similar post in c#. No
tattoos for me!

The solution was to reset the three ManualResetEvents connectionDone,
receivedDone, sendDone after the second Console.ReadLine();

Thanks anyway,
James Randle.
 
Back
Top