예제 #1
0
 private void OnClientReadingEvent(TcpSocketAsync client, int position, int length)
 {
     if (this.ClientReadingEvent != null)
     {
         this.ClientReadingEvent(client, position, length);
     }
 }
예제 #2
0
 private void OnClientErrorEvent(TcpSocketAsync client, Exception ex)
 {
     if (this.ClientErrorEvent != null)
     {
         this.ClientErrorEvent(client, ex);
     }
 }
예제 #3
0
 private void OnAcceptEvent(TcpSocketAsync client)
 {
     if (this.AcceptEvent != null)
     {
         this.AcceptEvent(client);
     }
 }
예제 #4
0
 private void OnClientReceiveEvent(TcpSocketAsync client, byte[] data, int length)
 {
     if (this.ClientReceiveEvent != null)
     {
         this.ClientReceiveEvent(client, data, length);
     }
 }
예제 #5
0
 private void BeginAccept(object obj)
 {
     try
     {
         while (this.isAccept)
         {
             Socket s      = this.socket.Accept();
             var    client = new TcpSocketAsync(s, this.SendBufferSize, this.ReceiveBufferSize);
             client.ErrorEvent   += this.OnClientErrorEvent;
             client.ReceiveEvent += this.OnClientReceiveEvent;
             client.ReadingEvent += this.OnClientReadingEvent;
             this.OnAcceptEvent(client);
             client.BeginReceive();
         }
     }
     catch (Exception ex)
     {
         this.OnServerErrorEvent(ex);
     }
 }