Sub Socket_Click
Dim Socket1 As Socket 'Network Lib
Socket1.Initialize("Socket")
Socket1.Connect("192.168.178.50",80,3000)
Wait For Socket_Connected(Successful As Boolean)
Log(Successful)
'if Successful ...
Log("Go on")
Dim Message As String
Message = "Hello PC"
Dim b() As Byte = Message.GetBytes("UTF-8")
Log("Send")
Dim o As OutputStream
o=Socket1.OutputStream
o.WriteBytes(b,0,b.Length)
o.Flush
Dim i As InputStream
i=Socket1.InputStream
Dim buffer(1024) As Byte
Dim count As Int = 0
Dim length As Int = 0
'response loop (need exit condition)
Do Until count=-1
'you can also send here more
length = i.BytesAvailable '?
count = i.ReadBytes(buffer, 0, length)
Sleep(0)
Log(BytesToString(buffer,0,length,"UTF-8"))
'Log("Run")
Loop
End Sub