示例#1
0
 private AsynchronousServer.DataReceiveCallback AcceptCallback(AsynchronousServer.State state)
 {
     m_DebugConsole?.WriteLine("Connection accepted", Brushes.Gray);
     if (m_State != null && !m_Stopped)
     {
         return(null);
     }
     m_State = state;
     if (m_AddrTo.Length > 0)
     {
         m_AddrTo = m_AddrFrom;
     }
     if (m_PortTo <= 0)
     {
         m_PortTo = m_PortFrom;
     }
     m_ConnectToDone.Reset();
     m_ClientThread.Start();
     m_ConnectToDone.WaitOne();
     if (m_State.m_Socket.Connected)
     {
         return(DataReceiveServerCallback);
     }
     m_State = null;
     return(null);
 }
示例#2
0
 private void DataReceiveServerCallback(AsynchronousServer.State state, int bytesRead)
 {
     if (!m_Stopped)
     {
         m_DebugConsole?.WriteLineAsString(state.m_Buffer, bytesRead, Brushes.Green);
         m_Client.Send(state.m_Buffer, bytesRead);
     }
 }