[RESOLVED] WinSock Connect/DisConnect
Hi all.
Can somebody tell me why the port sometimes is busy after a disconnect. I use Axwinsock.connect() and Axwinsock.close(). This happens only to the TCP connection, not the UDP connection. I'm using winsock in vb.net, my guess is that many think that's the problem.;)
And yes I can connect after a minute or so.
Re: WinSock Connect/DisConnect
So you're saying that after disconnecting from a certain address/port, you have to wait for a minute or so to be able to connect to it again?
Re: WinSock Connect/DisConnect
Hi
Yes, that's the case. Strange is that sometimes it work's, but most of the time I have to wait. In my VB6 progg that does the same job, i don't have this "problem".
Re: WinSock Connect/DisConnect
Well, you shouldnt be using winsock in .Net. There are far more powerful classes to handle this. Do you think you could "swap over" to using these classes instead?
Re: WinSock Connect/DisConnect
Well, not right on. But I know there is probably not any other way out. I'll try to make something with System.Net.Sockets, but I take it slow. When I think about it, could a switch that I connect to (Local Lan) cause this "port lock"?
Re: WinSock Connect/DisConnect
There really isn't any such thing as a "UDP connection."
While it isn't the preferred way to use TCP (or UDP) in .Net, the Winsock control should be usable from VB.Net with no special headaches. I'd suggest you look closely at how your VB6 and VB.Net code is written and see what you might be doing differently.
It is possible you're doing the same thing in both programs but never quite tested the VB6 program the same way. This sounds like the problem where a client sets a LocalPort value before connecting and/or a server sets RemotePort when accepting.
Re: WinSock Connect/DisConnect
Hi
You are right, I listen to a port using UDP, that port is receiving realtime data.
The TCP connection is connected to the same IP, (another port). By sending different commands I change the UDP data, sent from the host.
But, you solved my headache. The localport was set before connet. Now It's working without "locking" the port. I guess that I can wait a little longer before I move to .Net.Sockets.
Thank's all for you're help.