Click to See Complete Forum and Search --> : Winsock .Connect & .Close Problem


CaZs
February 5th, 1999, 05:03 AM
While connecting and closing is a no problem, but once i .close and want to reconnect ( .connect ) again, somehow the other side wouldnt want to respond to my .connect


Do i need like to initialize something or close some other function before reconnecting ( .connect ) again?


Client connects to server. No problem, client .close from server, no problem also. But when i want the client to .connect again to the server, no response.


Please help...

Kit
February 8th, 1999, 09:43 PM
This is the way that I solved this problem..


Whenever your application have to provide re-establish connection, you have to

1. create a form with winsock control (example name : frmsocket, and winsock)

2. Declare global variable as control (example : mysocket)

3. when you want to open connection

3.1 set mysocket = new frmsocket

3.2 openconnection by mysocket.winsock.open

4. when you want to close connection, you have also unload the form.

4.1 mysocket.winsock.close

4.2 mysocket.unload

4.3 set mysocket = nothings (release the resource for this objects)


because of everytime when the winsock has been opened, the system will generate the unique/unreuseable socket handlenumber automatically, so you have to always create a new winsock at runtime.


sorry for my weak english.

kit
February 8th, 1999, 09:43 PM
This is the way that I solved this problem..


Whenever your application have to provide re-establish connection, you have to

1. create a form with winsock control (example name : frmsocket, and winsock)

2. Declare global variable as control (example : mysocket)

3. when you want to open connection

3.1 set mysocket = new frmsocket

3.2 openconnection by mysocket.winsock.open

4. when you want to close connection, you have also unload the form.

4.1 mysocket.winsock.close

4.2 mysocket.unload

4.3 set mysocket = nothings (release the resource for this objects)


because of everytime when the winsock has been opened, the system will generate the unique/unreuseable socket handlenumber automatically, so you have to always create a new winsock at runtime.


sorry for my weak english.