Quote:
>Hello everybody,
>I wonder if somebody had ever experience the same thing I did !!!
>I create a vb application called server.vbp that is running on one pc.
>I create an other application called client.vbp on an other pc.
>The server creates a socket (listen method.)
>Then the client connects to the server (connect method)
>I am able to exchange data from server to client and vice-versa.
>I close the communication on the server and the communication is closed
>on both pc (state=closed). I am able to re-establish communcation and
>send data.
>If I close the communication on the client, the winsock state is closed
>on both
>pc, which is ok, but when I try back to initiate the communication on
>the server
>with the listen method it doesn't work anymore. I have to stop both vb
>programs
>and start again. I wonder why ???
>I am not to familiar with tcp/ip, maybe there is something I don't get !
>Seeking desperately for answers
>Marc
>--
>Le Groupe CIAC Inc.
>2101-P Nobel
>Ste-Julie, Quebec
>J3E 1Z8
>TL: (514) 922-4277
>FAX: (514) 922-4703
>Site Web: http://www.odyssee.net/~ciacnet
Hello Marc,
the first thing i did , was to create a new instance of the form that
includes the winsock-control, that allows multiple connections
I got the error "Adress is in use " when i didnt closed the winsock
correctly, like when an error occured (runtime error)
But this works fine, i can start and restart without probs.
Thomas
you can see the results at
http://www1.stuttgart.netsurf.de/~tomtom/dataspy.htm
'############################################################
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
On Error Resume Next
Dim o As Form
Static tt
Set o = New dbopen 'the same form (it includes the winsock-control
tt = tt + 1
o.instance = Format$(tt, "000")
If o.Winsock1.State <> sckClosed Then o.Winsock1.Close
o.Winsock1.Accept requestID
DoEvents
'show some info on the screen (label)
o.showconnect = "Connected" + Str$(o.Winsock1.LocalPort) +
str$(o.Winsock1.RemotePort) + "Remotehost:" + o.Winsock1.RemoteHost +
" localIp:" + o.Winsock1.LocalIP
DoEvents
o.WindowState = 1
o.Show
ginstance = ginstance + 1
Form2.Label1 = "Aktiv:" + Str$(ginstance)
End Sub
'##################################
'and i put this code in the winsock_close event
Private Sub Winsock1_Close()
'dont ask me why, i might have had the same prob
Winsock1.Close
Unload Me
End Sub