Hi,
I got a problem with Winsock you might have answers to.
Here is the situation:
I experimented with a client/server app in one machine only. I have a form, 3 Winsocks, and two textboxes, and 1 command button.
I am trying to send messages to my own machine...

WINSOCKS:
(for sending)
Name: Send
LocalPort: 1028

(for listening)
Name: Listen
LocaPort: 1029

Name of my PC on network: Nil

CODE:

On form load, I invoked the listener to listen:
Listen.LocalPort = 1029
Listen.Listen

On a command button:
Send.LocalPort=1028
Send.Connect "Nil",1029

(I hope I need not explain this further... the application works fine...)
HOWEVER, when I disconnect (Send.Close), of course it disconnects... BUT when I try to connect again on the same localport:
Send.LocalPort = 1028
Send.Connect "Nil",1029
(This is the same as the code above...)

The damn thing cant connect. ERROR: Port in use!!!
I hate to use another port. Is there a way to work around this? HOWEVER, after sometime, the port is free again!!! (I hate to wait too)

I want a clean close, not just the close method. I think the close method does not free the port. The damn thing thinks the port is still in use after I invoke the Close Method.

So I guess, my question is, is there a way to free a port? And, Why on earth is this happening?? (I know the basics of TCP/IP with Winsock... I just need to know the basics of PORTS... hehe...)

I have scrambled over tons of crap explanations but nothing tells me how to work around this... Nothing tells me something about a 'Neat' disconnect.

Any advice on this, please? Any help would be very much appreciated.

Thanks.
Jonaxse


[Edited by jonaxse on 11-02-2000 at 02:15 AM]