Ok thanks, I'v solved:
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.