Results 1 to 2 of 2

Thread: Closing a WinSock connection

  1. #1

    Thread Starter
    Hyperactive Member rockies1's Avatar
    Join Date
    Jul 1999
    Location
    Stuck at work
    Posts
    375

    Angry

    I have been able to connect to a server using Winsock, and I can send & receive data just fine.

    The problem, however, is that after the remote host closes the connection, my Winsock.State goes to 8, Closing, but never gets to 0, Closed.

    Am I missing something? I can't force the state to closed, but if it never actually closes, my program errors out when I try to re-connect.

    Any help is appreciated.

    Thanks!!
    Morgan
    [email protected] - Home
    [email protected] - Work
    Using VB6 SP6 but trying to learn VB2005EE

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    Are you specifying the LocalPort? If so, get rid of it and let the control pick one for you.

    If you open a CMD window and run NETSTAT after each connect and disconnect, you will probably see the client's connection go to state FIN_WAIT_2 after you close the session.

    By not specifying the LocalPort, a different (and available) port will be used on each connect request.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width