Example #1
0
 // Disconnecting
 protected virtual void OnSocketListen(int backlog, EndPoint endPoint)
 {
     SocketListen?.Invoke(this, new SocketListenEventArgs()
     {
         Backlog = backlog, LocalEndPoint = endPoint
     });
 }
Example #2
0
 public static void SendToAll(List <Tuple <IPAddress, int> > list, string content)
 {
     foreach (var tuple in list)
     {
         var client = SocketListen.FindClient(tuple);
         client?.Send(content);
     }
 }
Example #3
0
 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();
 }
Example #4
0
        protected void btnStart_Click(object sender, EventArgs e)
        {
            SocketListen listen = new SocketListen("192.168.1.119", 9901);

            listen.Start();
        }
Example #5
0
 /// <summary>
 /// client send message
 /// </summary>
 /// <param name="content"></param>
 public void Send(string content)
 {
     SocketListen.Send(Socket, content, this);
 }
Example #6
0
 /// <summary>
 /// disconnect this client
 /// </summary>
 public void DisConnect()
 {
     State.Status = StateEnum.ServerStop;
     SocketListen.Send(Socket, "server exit", this);
 }