byte array concatenation

  • Thread starter Thread starter Prasad
  • Start date Start date
P

Prasad

hi everyone,

This is prasad. I want to know how to concatenate two byte array
variables, can somebody help me.

thankx in advance.
 
Dear Herfried K Wagner,

Thank you Herfried K Wagner for your reply, I'm new to this method can
u please give an example for Buffer.BlockCopy. Please Don't mind that
my question sounds silly. I'm learning vb.net, I'm creating a client
and server application. Wherein the image stored in mysql database is
fetched from server application and passed to client application. I use
winsock connection, here i'm facing a problem in sending the image blob
data as byte from Server -> Client. I could able to see only half of
the image.

While tracing the program, the receiving function loops for 3 times. I
understood this is because the packet size handled here is large and so
it is being iterated for 3 times. So here i'm trying to concatenate the
byte array which is being executed for 3 times. Please suggest me an
efficient way to concatenate byte array.

Thanx in advance.
 
Prasad said:
Thank you Herfried K Wagner for your reply, I'm new to this method can
u please give an example for Buffer.BlockCopy. Please Don't mind that
my question sounds silly. I'm learning vb.net

No problem -- check out the sample below:

\\\
Dim Data1() As Byte = {1, 2, 3, 4}
Dim Data2() As Byte = {5, 6, 7, 8}
Dim Data(Data1.Length + Data2.Length - 1) As Byte
Buffer.BlockCopy(Data1, 0, Data, 0, Data1.Length)
Buffer.BlockCopy(Data2, 0, Data, Data1.Length, Data2.Length)
///
 
Back
Top