示例#1
0
        private void ReceivedMessageTcpBytes(PacketHeader header, ConnectionTcp connection, byte[] message)
        {
            HandledTask task = new HandledTask(() =>
            {
                _Clients[connection].ProcessCompressedMessage(ref message);
            });

            task.Start();
        }
示例#2
0
        internal void Start(MessagingConfiguration messagingSettings, IPEndPoint remoteEndPoint)
        {
            NetworkComms.AppendGlobalIncomingPacketHandler<byte[]>(Connection.TcpByteMessageName, ReceivedMessageTcpBytes);
             NetworkComms.AppendGlobalIncomingPacketHandler<string>("Message", ReceivedMessageTcpString);
             ConnectionInfo connectionInfo = new ConnectionInfo(ClientWorldManager.Instance.Configuration.Network.IpAddress, ClientWorldManager.Instance.Configuration.Network.PortTcp);
             _ClientTcp = TCPConnection.GetConnection(connectionInfo, true);

             _Client.Start();
             _Connection = new Connection(messagingSettings, _Client.Connect(remoteEndPoint), MultiPlayerProvider.ServerToClientProvider.ProcessReceivedMessage);
             _Connection.TcpConnection = _ClientTcp;
        }
示例#3
0
        internal Connection this[ConnectionTcp connectionTcp]
        {
            get
            {
                if (_TcpConnections.ContainsKey(connectionTcp))
                {
                    return(_TcpConnections[connectionTcp]);
                }

                return(null);
            }
        }
示例#4
0
        internal Connection this[ConnectionTcp connectionTcp]
        {
            get
             {
            if (_TcpConnections.ContainsKey(connectionTcp))
            {
               return _TcpConnections[connectionTcp];
            }

            return null;
             }
        }
示例#5
0
        internal void Start(MessagingConfiguration messagingSettings, IPEndPoint remoteEndPoint)
        {
            NetworkComms.AppendGlobalIncomingPacketHandler <byte[]>(Connection.TcpByteMessageName, ReceivedMessageTcpBytes);
            NetworkComms.AppendGlobalIncomingPacketHandler <string>("Message", ReceivedMessageTcpString);
            ConnectionInfo connectionInfo = new ConnectionInfo(ClientWorldManager.Instance.Configuration.Network.IpAddress, ClientWorldManager.Instance.Configuration.Network.PortTcp);

            _ClientTcp = TCPConnection.GetConnection(connectionInfo, true);

            _Client.Start();
            _Connection = new Connection(messagingSettings, _Client.Connect(remoteEndPoint), MultiPlayerProvider.ServerToClientProvider.ProcessReceivedMessage);
            _Connection.TcpConnection = _ClientTcp;
        }
示例#6
0
 private void ReceivedMessageTcpString(PacketHeader header, ConnectionTcp connection, string message)
 {
     try
     {
         Console.WriteLine("Paired TCP connection for {0}: {1}", message, connection.ConnectionInfo.RemoteEndPoint);
         _Clients.SetPlayerConnectionTcp(Convert.ToUInt16(message), connection);
         connection.SendObject("Message", "Connected");
     }
     catch (Exception ex)
     {
         ExceptionHandler.LogException(ex);
     }
 }
示例#7
0
 private void ReceivedMessageTcpString(PacketHeader header, ConnectionTcp connection, string message)
 {
     try
     {
         _ClientTcp = connection;
         Console.WriteLine("Server connection pair confirmation received: {0}", connection.ConnectionInfo.RemoteEndPoint);
         ClientWorldManager.Instance.RequestInitialTerrainData();
     }
     catch (Exception ex)
     {
         ExceptionHandler.LogException(ex);
     }
 }
示例#8
0
 private void ReceivedMessageTcpString(PacketHeader header, ConnectionTcp connection, string message)
 {
     try
      {
     Console.WriteLine("Paired TCP connection for {0}: {1}", message, connection.ConnectionInfo.RemoteEndPoint);
     _Clients.SetPlayerConnectionTcp(Convert.ToUInt16(message), connection);
     connection.SendObject("Message", "Connected");
      }
      catch (Exception ex)
      {
     ExceptionHandler.LogException(ex);
      }
 }
示例#9
0
 private void ReceivedMessageTcpBytes(PacketHeader header, ConnectionTcp connection, byte[] message)
 {
     HandledTask task = new HandledTask(() =>
     {
     _Clients[connection].ProcessCompressedMessage(ref message);
     });
      task.Start();
 }
示例#10
0
 internal void SetPlayerConnectionTcp(ushort playerId, ConnectionTcp connection)
 {
     this[playerId].TcpConnection = connection;
     _TcpConnections[connection]  = this[playerId];
 }
示例#11
0
 private void ReceivedMessageTcpString(PacketHeader header, ConnectionTcp connection, string message)
 {
     try
      {
     _ClientTcp = connection;
     Console.WriteLine("Server connection pair confirmation received: {0}", connection.ConnectionInfo.RemoteEndPoint);
     ClientWorldManager.Instance.RequestInitialTerrainData();
      }
      catch (Exception ex)
      {
     ExceptionHandler.LogException(ex);
      }
 }
示例#12
0
 internal void SetPlayerConnectionTcp(ushort playerId, ConnectionTcp connection)
 {
     this[playerId].TcpConnection = connection;
      _TcpConnections[connection] = this[playerId];
 }
示例#13
0
 public static void SetConnection(NetworkCommsDotNet.Connection connecton)
 {
     TcpConn = connecton;
 }