コード例 #1
0
 public void Send(int contextId, int module, int command, object packet)
 {
     if (_contextMap.TryGetValue(contextId, out var serverConnectorContext))
     {
         byte[] output = ConnectorsUtils.SerializePacket(module, command, packet);
         TcpSocketsUtils.Send(serverConnectorContext.Socket, output, serverConnectorContext.OnSend, serverConnectorContext.OnExcp);
     }
 }
コード例 #2
0
        public void Send(int module, int command, object packet)
        {
            if (IsConnected == false)
            {
                throw new InvalidOperationException("Connector not connected");
            }

            byte[] output = ConnectorsUtils.SerializePacket(module, command, packet);
            TcpSocketsUtils.Send(_socket, output, OnSend, OnExcp);
        }
コード例 #3
0
        public void Send(Func <ServerConnectorContext, bool> filter, int module, int command, object packet)
        {
            byte[] output = ConnectorsUtils.SerializePacket(module, command, packet);

            foreach (var connector in _contextMap.Values)
            {
                if (filter(connector))
                {
                    TcpSocketsUtils.Send(connector.Socket, output, connector.OnSend, connector.OnExcp);
                }
            }
        }