Hello Erel and thank you for your reply. I will surely move to Async, I think this is the best as suggested.
I am not quite sure I follow you on this, since in my case I have 2 'clients' and 1 'server'.
I connect from clientA to server, by using your recommended code:
Socket1.Initialize("Socket1")
Socket1.Connect ("xxx.xxx.x.xxx",xxxx,20000)
Then the socket1 event is raised, so I am sending data:
If Successful = False Then
Msgbox(LastException.Message, "Error connecting")
Return
End If
Dim sb As StringBuilder
sb.Initialize
Dim tr2 As TextWriter
sb.Append ("something")
Dim s As String
s=sb.ToString
tr2.Initialize2 (Socket1.OutputStream,"PrefEncoding")
tr2.WriteLine (s)
tr2.close
Socket1.Close
Now, what if at the very same moment, clientB sends data? Server is listening so it will handle both requests without a conflict? This thing is very important to me, since for 'server' I have a network printer and also another android for updating db records.
(By the way, I've noticed that 'successful' is always true, even if my 'server' is out of order, but I think there is a thread dealing with this, so I will check it out very soon.)