I am new to VB.NET and I have a bit of a problem. I've got a Client/Server program using the TcpClient and TcpListener. I am able to send strings from the Client to the Server using a NetworkStream and converting the strings from text to bytes using the following instructions:
'Convert string to bytes
Dim Buffer As [Byte]() = System.Text.Encoding.ASCII.GetBytes("String to send")
'Send contents of buffer (bytes)
NetworkStream.Write(Buffer, 0, Buffer.Length)
My question is: How can I possibly send an image from the client (TcpClient) to the server (TcpListener)? Would I have to convert the image into bytes in the same way as I've done with the strings, and if so how do I do that? If that's not possible, do you have any other suggestions?
I would greately appreciate any ideas.
'Convert string to bytes
Dim Buffer As [Byte]() = System.Text.Encoding.ASCII.GetBytes("String to send")
'Send contents of buffer (bytes)
NetworkStream.Write(Buffer, 0, Buffer.Length)
My question is: How can I possibly send an image from the client (TcpClient) to the server (TcpListener)? Would I have to convert the image into bytes in the same way as I've done with the strings, and if so how do I do that? If that's not possible, do you have any other suggestions?
I would greately appreciate any ideas.