Results 1 to 6 of 6

Thread: MSWINSCK.OCX Problem in Windows 7

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    5

    MSWINSCK.OCX Problem in Windows 7

    Hello All,

    My first time posting here, I hope I have done this correctly.

    My VB6 application uses the MSWINSCK.OCX control for a simple chat feature. I am using PORT 1010 with the TCPIP Protocol. When the application starts, I can place the Winsock control into the Listen Mode without problem. When another PC has connected with mine, we can chat back and fourth without a problem. The problem is when I perform the disconnect and attempt to return PORT 1010 to the LISTEN MODE I get an (Address in use) error.

    The testing and research that I have done, indicates that Windows is NOT releasing the PORT when I issue the CLOSE on the Winsock control. My Code has a Do Until Loop to make sure the Winsock Control is in the CLOSED state. Then when I set the Winsock Control into Listen state I get the error.

    I placed an Error Count Loop in the error routine and it appears that Windows is just taking its sweet time to release the Port.

    This same application works without flaw on previous Windows versions.

    Has anyone experienced this problem or have an Idea what is going on.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: MSWINSCK.OCX Problem in Windows 7

    After Close set RemotePort = 0 and then Listen. The "client" end should always be setting LocalPort = 0 before doing Connect.

    This isn't Windows, it is the way TCP works.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    5

    Re: MSWINSCK.OCX Problem in Windows 7

    I appreciate your response. Reseting the RemotePort and the LocalPort is part of my process. I will go back and confirm that I am performing this at the correct time.

    Do you know Is there any reason why this would work differently between Windows XP and Windows 7?

    Thanks

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: MSWINSCK.OCX Problem in Windows 7

    No reason I can think of. Looping for closed seems very, very strange. Normally both ends should monitor the Close event and close their end when it occurs.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    5

    Re: MSWINSCK.OCX Problem in Windows 7

    I have to Loop for Close because you can not put the Winsock Control into the Listen state unless it is in the Closed state.

    I appreciate your interest in helpping me. Do you have any experience with the Winsock Control in VB?

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: MSWINSCK.OCX Problem in Windows 7

    Quote Originally Posted by Pat Kelley View Post
    I appreciate your interest in helpping me. Do you have any experience with the Winsock Control in VB?
    He's one of the most experienced I would say.

    Another option is to not use the same winsock to connect. Dynamically load another winsock & connect with that one. This way, your listener is always listening. You can find many examples of chat projects about, even on this site. Try searching the CodeBank section for samples
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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