private void OnNewConnectionInternal(Listener listener, NewConnectionEventArgs args) { RawClient client = (RawClient)Activator.CreateInstance(m_ClientType); client.DisconnectEvent += OnClientDisconnectInternal; client.ConnectEvent += OnClientConnectInternal; client.AssignSocket(args.Socket, this); }
public virtual RawClient[] GetClients() { RawClient[] clients; lock (m_Clients) { clients = new RawClient[m_Clients.Count]; m_Clients.CopyTo(clients); } return(clients); }
private void OnClientConnectInternal(RawClient client, ConnectEventArgs args) { bool ok = false; lock ( m_Clients ) { if (!m_Clients.Contains(client)) { m_Clients.Add(client); ok = true; } } if (ok) { OnClientConnect(client, args); if (ClientConnectEvent != null) { ClientConnectEvent.Invoke(client, args); } } }
private void OnClientDisconnectInternal(RawClient client, DisconnectEventArgs args) { bool ok = false; lock ( m_Clients ) { if (m_Clients.Contains(client)) { client.DisconnectEvent -= OnClientDisconnectInternal; client.ConnectEvent -= OnClientConnectInternal; m_Clients.Remove(client); ok = true; } } if (ok) { OnClientDisconnect(client, args); if (ClientDisconnectEvent != null) { ClientDisconnectEvent.Invoke(client, args); } } }
protected override void Dispose(bool disposing) { m_Client = null; base.Dispose(disposing); }
internal IgeNetStream(RawClient client) { m_Client = client; }
public bool Start(int port) { return(Start(RawClient.GetMyIp(), port)); }
public bool Start() { return(Start(RawClient.GetMyIp(), RawClient.DefaultPort)); }
protected virtual void OnClientConnect(RawClient client, ConnectEventArgs args) { }
public Listener(int port) : this() { m_Binding = new IPEndPoint(RawClient.GetMyIp(), port); }
public Listener() { m_Socket = null; m_Binding = new IPEndPoint(RawClient.GetMyIp(), RawClient.DefaultPort); m_Thread = null; }