I've another Method, Beacuse sometimes SocketSize don't work everytimes
This method cut the Stream in little buffers, so Socket isn't too big to be send.
Use "FullBuffer" as String or Directly "Send" as Byte; be carefull with Charset.
BufferSizeMax = 2048 'Put here the max size of desired buffer
Charset = "UTF-8" ' OR ISO-8859-1 if you are in latin
Send = FullBuffer.GetBytes(Charset)
Log("Bytes Send : " & Send.Length)
For i = 0 To Send.Length -1 Step BufferSizeMax
BufferSize = Send.Length - 1
If (i + BufferSizeMax) > (Send.Length - 1) Then
BufferSize = Send.Length Mod BufferSizeMax
Else
BufferSize = BufferSizeMax
End If
AStreams.Write2(Send, i, BufferSize)
Next
Do While AStreams.OutputQueueSize > 0
Log("Astreams Queue : " & AStreams.OutputQueueSize)
Sleep(10)
Loop
AStreams.Close
Use a timer or the sleep function to temporize the out buffer.
Sub Sleep(Ms As Int)
Dim Ti As Long
Ti = DateTime.Now + (Ms)
Do While DateTime.Now < Ti
DoEvents
Loop
End Sub
Maybe this can help you :sign0087: