Socket closed, Port still active

Hi All,

In the application being developed, i have problem in disposing Socket Object.

Senario
-------


I have multiple TcpListeners (as thread) retriving messages parallelly. One Listener is created for each source (or sender). Program is working fine.

Each TcpListener object in stored in a collection. GUI is provided to Start/Stop each thread. Whenever thread is aborted, TcpListener is stopped by calling Stop method in stored object (TcpListener object). Socket is also closed by calling TcpListener_object.Server.Close().

Port is still active (i.e. not released). I have verified by using netstat (MS DOS Command).

Kindly suggest me how to close the socket under this scenario.

Thanks & Regards,
kalai



Answer this question

Socket closed, Port still active

  • Mary555

    Hello

    I am having a problem with some VBA coding with the winsock control from microsoft access.

    The problem is, i can connect to the server winsock control through port 10000, however when i issue the close() command it leaves the connection state in the fin_wait_2 state.

    Another POS application then tries to connect to the server through the same port and cant.

    I have to figure out how to close the connection properly. I thought the close() event should do this can someone please help me

    Thankyou

    Darrell


  • georgem

    Hi Darrell,

    After closing, i had disposed the object and created new when required. I am not sure about your scenario. You could try by disposing it.

    Hope this will give some idea.

    Best Regards,
    kalai



  • cahit

    Mike,

    Thanks a lot.

    I have managed to solve it.

    With Regards,

    kalai


  • jm.blairon

    what state is the connection in when you look at it using netstat (TIME_WAIT or ). After a socket is closed it will enter TIME_WAIT state to ensure no stray packets get associated with another connection. For more details, see http://tangentsoft.net/wskfaq/articles/debugging-tcp.html

  • Socket closed, Port still active