Say I want to arrange bytes in the internal buffer in a certain way. I
receive those bytes in the socket.
One solution is to read in socket in pieces:
byte[] buffer = new byte[65536];
int index = 0;
m_socket.Receiv e(buffer , 8, SocketFlags.Non e);
index += 8;
//read the rest of the message
//int msgLength is remaining number of bytes in the buffer
m_socket.Receiv e(buffer , index, msgLen - index,
SocketFlags.Non e);
Questions:
1. How to calculate msgLength ?
2. How to make this operation when reading data in asynchronously,
using BeginReceive()
Thanks
receive those bytes in the socket.
One solution is to read in socket in pieces:
byte[] buffer = new byte[65536];
int index = 0;
m_socket.Receiv e(buffer , 8, SocketFlags.Non e);
index += 8;
//read the rest of the message
//int msgLength is remaining number of bytes in the buffer
m_socket.Receiv e(buffer , index, msgLen - index,
SocketFlags.Non e);
Questions:
1. How to calculate msgLength ?
2. How to make this operation when reading data in asynchronously,
using BeginReceive()
Thanks
Comment