Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
                }
            }
        }