I send the image to the server, I noticed that it is receiving the image in several packages, I tried to join the buffers, but it is not working, if I put the image in the picturebox without joining the buffers the image is incomplete
My project consists of several clients and a server that is responsible for passing the imgs
Sending Img
<pre lang="vb">
Dim imgMemoryStream As MemoryStream = New MemoryStream()
Dim imgByteArray As Byte()
Imagem.Save(imgMemoryStream, System.Drawing.Imaging.ImageFormat.Jpeg)
imgByteArray = imgMemoryStream.GetBuffer()
serverStream.Write(imgByteArray, 0, imgByteArray.Length)
serverStream.Flush()
Resending Img
Dim networkStream As NetworkStream = clientSocket.GetStream()
networkStream.Read(bytesFrom, 0, CInt(clientSocket.ReceiveBufferSize))
serverStream.Write(bytesFrom, 0, bytesFrom.Length)
serverStream.Flush()
Another customer receiving
Dim networkStream As NetworkStream = clientSocket.GetStream()
networkStream.Read(bytesFrom, 0, CInt(clientSocket.ReceiveBufferSize))
Dim buffSize As Integer
Dim inStream(10024) As Byte
buffSize = clientSocket.ReceiveBufferSize
serverStream.Read(inStream, 0, buffSize)
Dim imgMemoryStream = New IO.MemoryStream(img)
PictureBox1.Image = Drawing.Image.FromStream(imgMemoryStream)
Can anyone give me an example of how to join the bytes that are sent from the server into a single variable?
What I have tried:
I put it to the client to send a message containing the length of the image, the other client would receive the length and wait for the bytes, and would join in a var, everything went well except for the piece of joining the bytes