예제 #1
0
    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));
    }
예제 #2
0
    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();
    }