Big TCP Issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pigeonrandle

    #1

    Big TCP Issue

    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/de...ary/en-us/cpgu...


    Client:

    http://msdn.microsoft.com/library/de...ary/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.ReadLin e();
    StartClient();
    Console.ReadLin e();
    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.

  • pigeonrandle

    #2
    Re: Big TCP Issue

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

    The solution was to reset the three ManualResetEven ts connectionDone,
    receivedDone, sendDone after the second Console.ReadLin e();

    Thanks anyway,
    James Randle.



    pigeonrandle wrote:
    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/de...ary/en-us/cpgu...
    >
    >
    Client:
    >
    http://msdn.microsoft.com/library/de...ary/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.ReadLin e();
    StartClient();
    Console.ReadLin e();
    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.

    Comment

    Working...