#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Location
    Lahore
    Posts
    8
    Rep Power
    0

    Address in Use "Winsock"


    Hi,
    I used winsock my chat application on form_unload i close my winsock by winsock.close but when i run again that program it show the error "Address in Use" . So, any person plz give me full detail to how completely close a connection....

    Waiting for response.
    Riz.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Lagos,NIGERIA.
    Posts
    21
    Rep Power
    0
    are you using an array of winsock controls ( most chat programs use array of controls that are loaded. I so u must unload all , or close all such controls . Again what address are u using . The address must not be any of the reserved address
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    6
    Rep Power
    0

    Re: Address in Use "Winsock"


    Originally posted by rizbaig_pk
    Hi,
    I used winsock my chat application on form_unload i close my winsock by winsock.close but when i run again that program it show the error "Address in Use" . So, any person plz give me full detail to how completely close a connection....

    Waiting for response.
    Riz.

    Read this, it'll give you all the info you need.

    http://support.microsoft.com/?kbid=173619
  6. #4
  7. No Profile Picture
    Rich Smith
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Address in Use "Winsock"


    Originally posted by rizbaig_pk
    Hi,
    I used winsock my chat application on form_unload i close my winsock by winsock.close but when i run again that program it show the error "Address in Use" . So, any person plz give me full detail to how completely close a connection....

    Waiting for response.
    Riz.

    This is one of the reasons that I prefer not to use the winsock control when I need to do tcpip communications. I would highly recommend using direct calls to the winsock API, then you could program around the problem you are having. Here it is in a nutshell.

    When you tell your winsock control to close the connection, it immediately executes a shutdown command, followed by a close. Berkley Sockets (which is what the windows interface to tcpip is based on) calls for sockets that have ACCEPTED another connection, and that have been closed without recieving notification that the other side has finished sending information will linger on your system for approximately 3 minutes. While this is still ok if you are using the API to listen for connections, the winsock control doesnt like this and wont let you use the port again.

    This may be a little overkill for your needs, but if you want a really robust chat application, the winsock control just isnt going to cut the mustard.

IMN logo majestic logo threadwatch logo seochat tools logo