private void ReceivedMessageTcpBytes(PacketHeader header, ConnectionTcp connection, byte[] message) { HandledTask task = new HandledTask(() => { _Clients[connection].ProcessCompressedMessage(ref message); }); task.Start(); }
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; }
internal Connection this[ConnectionTcp connectionTcp] { get { if (_TcpConnections.ContainsKey(connectionTcp)) { return(_TcpConnections[connectionTcp]); } return(null); } }
internal Connection this[ConnectionTcp connectionTcp] { get { if (_TcpConnections.ContainsKey(connectionTcp)) { return _TcpConnections[connectionTcp]; } return null; } }
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; }
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); } }
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); } }
internal void SetPlayerConnectionTcp(ushort playerId, ConnectionTcp connection) { this[playerId].TcpConnection = connection; _TcpConnections[connection] = this[playerId]; }
public static void SetConnection(NetworkCommsDotNet.Connection connecton) { TcpConn = connecton; }