-
Feb 10th, 2012, 02:30 PM
#1
Thread Starter
New Member
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.
-
Feb 11th, 2012, 02:41 PM
#2
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.
-
Feb 11th, 2012, 03:01 PM
#3
Thread Starter
New Member
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
-
Feb 11th, 2012, 03:47 PM
#4
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.
-
Feb 11th, 2012, 05:25 PM
#5
Thread Starter
New Member
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?
-
Feb 25th, 2012, 11:46 AM
#6
Re: MSWINSCK.OCX Problem in Windows 7
Originally Posted by Pat Kelley
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|