internal GameClient(uint ClientId, ConnectionInformation pConnection) { Id = ClientId; Connection = pConnection; CurrentRoomUserID = -1; packetParser = new GamePacketParser(this); }
private void connectionChanged(ConnectionInformation information, ConnectionState state) { if (state == ConnectionState.closed) { this.CloseConnection(information); } }
private void connectionChanged(ConnectionInformation information, ConnectionState state) { if (state == ConnectionState.CLOSED) { CloseConnection(information); } }
internal GameClient(uint ClientId, ConnectionInformation pConnection) { this.Id = ClientId; this.Connection = pConnection; this.CurrentRoomUserID = -1; this.packetParser = new GamePacketParser(this); this.Connection.SetClient(this); }
public GameClient(int ClientId, ConnectionInformation pConnection) { this._id = ClientId; this._connection = pConnection; this._packetParser = new GamePacketParser(this); this.PingCount = 0; }
private void connectionChanged(ConnectionInformation information, ConnectionState state) { if (state == ConnectionState.closed) { CloseConnection(information.getConnectionID()); liveConnections.Remove(information.getConnectionID()); } }
internal GameClient(uint ClientId, ConnectionInformation pConnection) { Id = ClientId; Connection = pConnection; SetDoorPos = false; CurrentRoomUserID = -1; packetParser = new GamePacketParser(); }
private void connection_connectionChanged(ConnectionInformation information, ConnectionState state) { switch (state) { case ConnectionState.closed: disconnect(); break; } }
public ConnectionHandeler(ConnectionManager.ConnectionInformation connection) { this.connection = connection; this.packetRegister = new PacketRegistery <ServerOpCode, ServerIncomingPacket>(); packetRegister.registerPacket(ServerOpCode.Core_client_sends_version, ServerReceivedVersion); connection.sendData(new SharedPacketLib.DataPackets.ServerOutgoingPacket(ClientOpCode.Core_send_version)); this.connection.connectionChanged += connection_connectionChanged; (this.connection.parser as GamePacketParser).packetArrival += ConnectionHandeler_packetArrival; }
public ConnectionHandeler(ConnectionManager.ConnectionInformation connection) { this.connection = connection; this.packetRegister = new PacketRegistery<ServerOpCode, ServerIncomingPacket>(); packetRegister.registerPacket(ServerOpCode.Core_client_sends_version, ServerReceivedVersion); connection.sendData(new SharedPacketLib.DataPackets.ServerOutgoingPacket(ClientOpCode.Core_send_version)); this.connection.connectionChanged += connection_connectionChanged; (this.connection.parser as GamePacketParser).packetArrival += ConnectionHandeler_packetArrival; }
private void CloseConnection(ConnectionInformation Connection) { try { Connection.Dispose(); SilverwaveEnvironment.GetGame().GetClientManager().DisposeConnection((uint)Connection.getConnectionID()); } catch (Exception e) { Logging.LogException(e.ToString()); } }
private void CloseConnection(ConnectionInformation Connection) { try { Connection.Dispose(); CyberEnvironment.GetGame().GetClientManager().DisposeConnection(checked((uint)Connection.getConnectionID())); } catch (Exception ex) { Logging.LogException(ex.ToString()); } }
private void CloseConnection(ConnectionInformation Connection) { try { Connection.Dispose(); PlusEnvironment.GetGame().GetClientManager().DisposeConnection(Convert.ToInt32( Connection.getConnectionID())); } catch (Exception e) { Logging.LogException(e.ToString()); } }
private void newConnectionRequest(IAsyncResult iAr) { checked { if (this.connectionListener != null && this.acceptConnections) { try { Socket socket = ((Socket)iAr.AsyncState).EndAccept(iAr); socket.NoDelay = this.disableNagleAlgorithm; string ip = socket.RemoteEndPoint.ToString().Split(new char[] { ':' })[0]; this.acceptedConnections++; ConnectionInformation connectionInformation = new ConnectionInformation(socket, this.acceptedConnections, this, this.parser.Clone() as IDataParser, ip); this.reportUserLogin(ip); connectionInformation.connectionChanged += new ConnectionInformation.ConnectionChange(this.c_connectionChanged); if (this.connectionEvent != null) { this.connectionEvent(connectionInformation); } } catch { } finally { this.connectionListener.BeginAccept(new AsyncCallback(this.newConnectionRequest), this.connectionListener); } } } }
private void c_connectionChanged(ConnectionInformation information, ConnectionState state) { if (state == ConnectionState.CLOSED) { reportDisconnect(information); } }
internal void Stop() { if (GetMessageHandler() != null) MessageHandler.Destroy(); if (GetHabbo() != null) Habbo.OnDisconnect(); CurrentRoomUserID = -1; this.MessageHandler = null; this.Habbo = null; this.Connection = null; }
public QueuedServerMessage(ConnectionInformation connection) { this.userConnection = connection; this.packet = new List<byte>(); }
public void CreateAndStartClient(int clientID, ConnectionInformation connection) { GameClient Client = new GameClient(clientID, connection); if (this._clients.TryAdd(Client.ConnectionID, Client)) Client.StartConnection(); else connection.Dispose(); }
private void manager_connectionEvent(ConnectionInformation connection) { connection.connectionChanged += connectionChanged; PlusEnvironment.GetGame().GetClientManager().CreateAndStartClient(Convert.ToInt32(connection.getConnectionID()), connection); }
private void manager_connectionEvent(ConnectionInformation connection) { liveConnections.Add(connection.getConnectionID(), connection); connection.connectionChanged += connectionChanged; ButterflyEnvironment.GetGame().GetClientManager().CreateAndStartClient((uint)connection.getConnectionID(), connection); }
/// <summary> /// Reports a gameconnection as disconnected /// </summary> /// <param name="gameConnection">The connection which is logging out</param> public void reportDisconnect(ConnectionInformation gameConnection) { gameConnection.connectionChanged -= c_connectionChanged; reportUserLogout(gameConnection.getIp()); activeConnections.Remove(gameConnection.getConnectionID()); }
public void SetConnection(ConnectionInformation con) { this.con = con; this.onNewPacket = null; }
/// <summary> /// Handels a new incoming data request from some computer from arround the world /// </summary> /// <param name="iAr">the IAsyncResult of the connection</param> private void newConnectionRequest(IAsyncResult iAr) { if (this.connectionListener != null) { if (acceptConnections) { try { Socket replyFromComputer = ((Socket)iAr.AsyncState).EndAccept(iAr); replyFromComputer.NoDelay = this.disableNagleAlgorithm; Out.writeLine("New connection from [" + replyFromComputer.RemoteEndPoint.ToString().Split(':')[0] + "].", Out.logFlags.StandardLogLevel); if (activeConnections.Count < maximumConnections) { string Ip = replyFromComputer.RemoteEndPoint.ToString().Split(':')[0]; if (getAmountOfConnectionFromIp(Ip) < maxIpConnectionCount) { acceptedConnections++; Out.writeLine("Accepted connection [" + acceptedConnections + "] from [" + replyFromComputer.RemoteEndPoint.ToString().Split(':')[0] + "].", Out.logFlags.BelowStandardlogLevel); ConnectionInformation c = new ConnectionInformation(replyFromComputer, acceptedConnections, this, parser.Clone() as IDataParser, Ip); reportUserLogin(Ip); c.connectionChanged += c_connectionChanged; activeConnections.Add(acceptedConnections, c); if (connectionEvent != null) connectionEvent(c); } else Out.writeLine("Connection denied from [" + replyFromComputer.RemoteEndPoint.ToString().Split(':')[0] + "]. The user has too many connections", Out.logFlags.StandardLogLevel); } else Out.writeLine("Maximum amount of connections reached " + maximumConnections, Out.logFlags.ImportantLogLevel); } catch (Exception ex) { Out.writeError(ex.Message); } finally { connectionListener.BeginAccept(new AsyncCallback(newConnectionRequest), connectionListener); } } else { Out.writeLine("Connection denied, server is not currently accepting connections!", Out.logFlags.StandardLogLevel); } } }
internal void Dispose() { this.packet.Clear(); this.userConnection = null; }
internal void CreateAndStartClient(uint clientID, ConnectionInformation connection) { GameClient obj = new GameClient(clientID, connection); if (this.clients.Contains(clientID)) { this.clients.Remove(clientID); } lock (this.clientsAddQueue.SyncRoot) { this.clientsAddQueue.Enqueue(obj); } }
protected void CConnectionChanged(ConnectionInformation information, ConnectionState state) { if (state == ConnectionState.closed) { this.ReportDisconnect(information); } }
private void manager_connectionEvent(ConnectionInformation connection) { connection.connectionChanged += new ConnectionInformation.ConnectionChange(this.connectionChanged); CyberEnvironment.GetGame().GetClientManager().CreateAndStartClient(checked((uint)connection.getConnectionID()), connection); }
static void man_connectionEvent(ConnectionManager.ConnectionInformation connection) { //TODO something with your new connection new ConnectionHandeler(connection); }
public Client(NettyServer.Connection iAr) { try { _connection = iAr; Socket thisSocket = _connection.Socket; IP = thisSocket.RemoteEndPoint.ToString().Split(new char[]{':'})[0]; this.acceptedConnections++; ConnectionInformation connectionInformation = new ConnectionInformation(thisSocket, this.acceptedConnections, this, this.parser, IP); this.reportUserLogin(IP); connectionInformation.connectionChanged += new ConnectionInformation.ConnectionChange(this.CConnectionChanged); if (connectionEvent != null) { connectionEvent(connectionInformation); } } catch (Exception ex) { Console.WriteLine(ex); } }
private void c_connectionChanged(ConnectionInformation information, ConnectionState state) { if (state == ConnectionState.closed) { this.reportDisconnect(information); } }
public void reportDisconnect(ConnectionInformation gameConnection) { gameConnection.connectionChanged -= new ConnectionInformation.ConnectionChange(this.c_connectionChanged); this.reportUserLogout(gameConnection.getIp()); }
internal void CreateAndStartClient(uint clientID, ConnectionInformation connection) { GameClient client = new GameClient(clientID, connection); if (clients.ContainsKey(clientID)) clients.Remove(clientID); lock (clientsAddQueue.SyncRoot) { clientsAddQueue.Enqueue(client); } }
/// <summary> /// Reports a gameconnection as disconnected /// </summary> /// <param name="gameConnection">The connection which is logging out</param> public void reportDisconnect(ConnectionInformation gameConnection) { gameConnection.connectionChanged -= c_connectionChanged; reportUserLogout(gameConnection.getIp()); //activeConnections.Remove(gameConnection.getConnectionID()); }