private void AcceptCompleted(object sender, SocketAsyncEventArgs e) { if (e.SocketError == SocketError.Success) { ClientConnection Client = new ClientConnection(e.AcceptSocket); IPEndPoint ipEp = (IPEndPoint)e.AcceptSocket.RemoteEndPoint; Client.Disconnected += client_Disconnected; Client.Recieved += client_Recieved; if (this.Connected != null) this.Connected(this, new ConnectionEventArgs(ipEp.Address, ipEp.Port)); } e.AcceptSocket = null; AcceptAsync(AcceptAsyncArgs); }
public void Send(byte[] data) { ClientConnection.Send(data); }