// Disconnecting protected virtual void OnSocketListen(int backlog, EndPoint endPoint) { SocketListen?.Invoke(this, new SocketListenEventArgs() { Backlog = backlog, LocalEndPoint = endPoint }); }
public static void SendToAll(List <Tuple <IPAddress, int> > list, string content) { foreach (var tuple in list) { var client = SocketListen.FindClient(tuple); client?.Send(content); } }
protected override void OnStart(string[] args) { #region string path = @"C:\Logs\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } #endregion listen = new SocketListen(ipAdress, port); listen.Start(); }
protected void btnStart_Click(object sender, EventArgs e) { SocketListen listen = new SocketListen("192.168.1.119", 9901); listen.Start(); }
/// <summary> /// client send message /// </summary> /// <param name="content"></param> public void Send(string content) { SocketListen.Send(Socket, content, this); }
/// <summary> /// disconnect this client /// </summary> public void DisConnect() { State.Status = StateEnum.ServerStop; SocketListen.Send(Socket, "server exit", this); }