problem during restart async. TCP server ??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ikado
    New Member
    • Jul 2007
    • 2

    problem during restart async. TCP server ??

    I have an async. tcp server, I want to restart it in some periods.
    but there is a problem
    I am closing all sockets,
    Initializing new IPEndPoint and binding it,
    I am creating a new listening socket,
    And it continues with
    Client.Listenin gSocket.BeginAc cept(new AsyncCallback(O nClientConnect) , null);
    It works normally when any client is not trying to connect..
    But when any client try to connect during restart I got an exception in Onclientconnect line,
    Socket ActiveSocket = Client.Listenin gSocket.EndAcce pt(asyn);
    --------
    Cannot access a disposed object.
    Object name: 'System.Net.Soc kets.Socket
    --------
    or
    -------
    Object reference not set to an instance of an object.
    --------

    pls help,
Working...