Beispiel #1
0
        private void _PollIn(Socket sock, OctetsStream osReadBuffer, byte[] readBuffer)
        {
            if (!sock.Poll(_pollWaitTime, SelectMode.SelectRead))
            {
                return;
            }

            var readLength = sock.Receive(readBuffer, readBuffer.Length, SocketFlags.None);

            if (readLength == 0)
            {
                throw new SocketException((int)SocketError.ConnectionReset);
            }

            NetUtil.Decode(osReadBuffer, readBuffer, readLength);
        }
Beispiel #2
0
        public sealed override void PutRespondMsg(byte[] msg, object userdata)
        {
            V protoRespond = NetUtil.Deserialize <V> (msg);

            OnRespond(protoRespond, userdata);
        }