Tnx for this code, will be using this!
But as Lecarre said before, the following should be changed.
#1
$sRecv = StringLeft($Clients[$i][3], StringInStr($Clients[$i][3], @CRLF, 0, -1)) ;Pull all data to the left of the last @CRLF in the buffer
Pulls on the last CRLF, should pull the first, when it recieved both login and password it pulled both. Should Pull only 1 at a time.
Fixed Changed -1 to 1
#region ;Example message processing stuff here. This is handling for a simple "echo" server
While 1 ; While Messages are found
$sRecv = StringLeft($Clients[$i][3], StringInStr($Clients[$i][3], @CRLF, 0, 1)) ;Pull all data to the left of the First @CRLF in the buffer
If $sRecv = "" Then ExitLoop ;Check if there were any complete "messages"
$Clients[$i][3] = StringTrimLeft($Clients[$i][3], StringLen($sRecv) +1 ) ;remove what was just read from the client's buffer
TCPSend($Clients[$i][0], "Echo: " & $sRecv & @CRLF) ;Echo back what the client sent
wend
#endregion ;Example
Using -1 will give problems when reveiving multiple packets from the buffer.