public TcpSocket() { mDataBuffer = new byte[BufferLength]; mCurPosition = 0; mReceiveLoopBuffer = new LoopBuffer(ReceiveLoopBufferLength); mSendBuffer = new byte[BufferLength]; mReceiveBuffer = new byte[BufferLength]; MsgPrefixLength = Marshal.SizeOf(typeof(T)); }
public TcpSocket(Socket clientSocket, OnReceivedCallback receivedCallback) { mDataBuffer = new byte[BufferLength]; mCurPosition = 0; mReceiveLoopBuffer = new LoopBuffer(ReceiveLoopBufferLength); mSendBuffer = new byte[BufferLength]; mReceiveBuffer = new byte[BufferLength]; MsgPrefixLength = Marshal.SizeOf(typeof(T)); mSocket = clientSocket; mOnReceivedCallback = receivedCallback; _Receive(); }