server.New1(50000) 'Listens on port 50000 (all ip's available).
server.Start ' Server Objekt for send (Server is always a Sender)
client.New1 ' Client Object for receiving
client.Value = server.Accept 'This line will block waiting for the other client to connect.
Msgbox("Server connected.")
stream.New1(client.GetStream,false) 'Creates a BinaryFile object using the GetStream method.
Do While true
If client.DataAvailable Then Msgbox(stream.ReadString)
DoTasks
Loop
End Sub
It works fine, but if I use:
client.Connect(client.GetIP2("MSHEIMNETZ"),50000) ' use WLAN
with 'MSHEIMNETZ' name of the WLAN-network instead of the Activesync IP 'PPP_PEER', I get error messages.
client.Connect(client.GetIP2("MSHEIMNETZ"),50000) ' use WLAN
with 'MSHEIMNETZ' name of the WLAN-network instead of the Activesync IP 'PPP_PEER', I get error messages.
What have I to do?
In the funktion client.connect you have to use the server-IP not the client one. In the client-server-modell the server is allways listening not the client.
server.New1(50000) 'Listens on port 50000 (all ip's available).
server.Start ' Server Objekt zum Senden (Server ist immer Sender)
client.New1 ' Also Client Objekt for the receive part
Do While server.Pending = false
DoEvents
Loop
client.Value = server.Accept
Msgbox("Server connected.")
stream.New1(client.GetStream,false) 'Creates a BinaryFile object using the GetStream method.
Do While true
If client.DataAvailable Then Msgbox(stream.ReadString)
DoTasks
DoEvents
Loop