Here is a snipet of the code.
// State object for receiving data from remote device.
public class StateObject
{
// Client socket.
public Socket workSocket = null;
// Size of receive buffer.
public const int BufferSize = 256;
// Receive buffer.
public byte[] buffer = new byte[BufferSize];
// Received data string.
public StringBuilder sb = new StringBuilder();
}
================================================== ===
StateObject state = (StateObject) ar.AsyncState;
When Data returns from socket
state.sb.ToString(); Contains "0\0\0\0" This is the 32 bit win32
error code
this is Success code.
state.sb.ToString(); Contains "\0\0\0" This is an Error where
is value of 2 ( #define ERROR_FILE_NOT_FOUND 2L )
How do I convert the bytes stored in the string to an int32?