예제 #1
0
        public void SendBasicMessage(short opCode, Action <NetWriter> writeAction,
                                     int?requestId, int?responseId, ResponseStatus?status, byte defaultFlags = 0)
        {
            if (_isDisconnected)
            {
                return;
            }

            byte[] data;

            if (!IsVirtual)
            {
                lock (_writer)
                {
                    GcProtocol.PackMessage(_writer, opCode, writeAction, requestId, responseId, status, null, defaultFlags);
                    data = _writer.ToArray();
                }
                _connection.SendRawData(data);
            }
            else
            {
                lock (_writer)
                {
                    GcProtocol.PackMessage(_writer, opCode, writeAction, requestId, responseId, status, PeerId, defaultFlags);
                    data = _writer.ToArray();
                }
                _concretePeer.SendRawData(data);
            }
        }
        private void SendBasicMessage(short opCode, Action <NetWriter> writeAction,
                                      int?requestId, int?responseId, ResponseStatus?status, int?peerId, byte defaultFlags = 0)
        {
            byte[] data;

            lock (_writer)
            {
                GcProtocol.PackMessage(_writer, opCode, writeAction, requestId, responseId, status, peerId, defaultFlags);
                data = _writer.ToArray();
            }

            Implementation.SendRawData(data);
        }