you didnt solve anything, you just masked a very important fact about sending and receiving data =)
when you send packets with very short delay between them, they are usually packed together
you ARE NOT SENDING STRINGS
you are sending data
if you want to send "lines" to another destination, you need to have a LINE BREAKER, just like everywhere else
this text im writing has new lines everywhere that makes this text easier on the eyes
like this, because there is a specific character, or characters (CR and LF) that actually have the specific purpose of meaning line-break =)
carriage return (CR) and line feed (LF)
in networking you can choose your own character, or characters that define the end of a message, and a beginning of a new one
here is a short example:
Code: Select all
'' Send data
Const _CR_ = Chr(13)
Const _LF_ = Chr(10)
Const _CRLF_ = WChr(13, 10)
Sub inetSend(d As String)
d += _CRLF_
socket.write(d, Len(d))
End Sub
inetSendRaw("Hello, ")
inetSendRaw("world!")
'' And on the other side where you receive:
Dim Shared As String buffer
Sub ReceiveData(textReceived As String)
Dim As String onecharacter
Dim As Integer i
For i = 1 to len(textReceived)
onecharacter = Mid(textReceived, i, 1)
If onecharacter = _CR_ Or onecharacter = _LF_ Then
If Len(buffer) Then
Print buffer 'this is the received LINE
buffer = "" 'clear buffer, and reuse it
EndIf
Else
buffer += onecharacter
EndIf
Next
End Sub