Unless there is an error then all the data you write with AStream.Write will be sent. If there is an error then the connection will break and the Error or Terminated events will fire.
1. Send a CountingInputStream with AStream.WriteStream. This is good if you are sending a single large message (or file).
2. Check the queue size with OutputQueueSize. This is useful if you are sending many small messages. OutputQueueSize doesn't return bytes, it returns the number of messages waiting to be sent.
Thanks for your reply, but I can only use WRITE, I'm using visual basic to receive files, I tried to send them with WriteStream but it does not work, accept only WRITE mode, do you have an example of how to receive file with WriteStream in vb.net?
I'v made this, it work and send file, but the counter of countingStream is allways 0
Private asi As OutputStream
Public countingStream As CountingOutputStream
asi=Socket1.OutputStream
countingStream.Initialize(asi)
asi.WriteBytes(BufferFoto,0,BufferFoto.Length)
Dim in As InputStream
Dim countingStream As CountingInputStream
Dim asi As AsyncStreams
asi.InitializePrefix(Socket1.InputStream,True,Socket1.OutputStream,"asi")
in.InitializeFromBytesArray(BufferFoto, 0, BufferFoto.Length)
countingStream.Initialize(in)
asi.WriteStream(countingStream, BufferFoto.Length)
this is the way to read the amount of bytes transferred to an other device via TCP socket.