Quote:
Originally Posted by Tex8503
Can the server send data back in the same way?
|
Yes. Because on the Server side; a Client and BinaryFile stream are also set up. Add these snippets to your
SERVER code. You will need two timers too, one WFC(Wait For Connection) and one WFD(Wait For Data):
'Server' is a Network.dll Server object
'Client' is a Network.dll Client object
'Stream' is a BinaryFile.dll BinaryFile object
Code:
Sub App_Start
'...
Server.New1(50000)
Server.Start
Client.New1
TimerWFC.Enabled=True
'...
End Sub
Sub TimerWFC_Tick
If Server.Pending=True Then
Client.Value=Server.Accept
Stream.New1(Client.GetStream,False)
TimerWFC.Enabled=False
TimerWFD.Enabled=True
End If
End Sub
Sub TimerWFD_Tick
If Client.DataAvailable=True Then
Variable=Stream.ReadString
End If
End Sub
To write anything back; use any of the BinaryFile.Writexxxx methods, such as
Code:
...
Stream.WriteString("ASCII Text")
...