Exemple #1
0
 protected void OnNewClientAcceptedAsync(Socket socket, object state)
 {
     if (NewClientAccepted != null)
     {
         NewClientAccepted.BeginInvoke(this, socket, state, null, null);
     }
 }
        public bool Start()
        {
            try
            {
                _port.Open();

                //the serial port is diffent with the tcp, Client connections cannot be distinguished,and serial port never trigger the accept event
                //so the serial port only one channel and one client
                //so it need manual trigger the accept ,let the supersocket framework to force create the connection session
                NewClientAccepted?.Invoke(this, _channelFactory(_port).Result);

                return(true);
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"serial port: {_port.PortName} open fail!");

                return(false);
            }
        }
 protected virtual void OnNewClientAccepted(Socket socket, object state)
 {
     NewClientAccepted.BeginInvoke(this, socket, state, null, null);
 }
 protected virtual void OnNewClientAccepted(Socket socket, object state)
 {
     NewClientAccepted?.Invoke(this, socket, state);
 }
Exemple #5
0
 private void OnNewClientAccept(Socket socket)
 {
     NewClientAccepted?.Invoke(this, socket);
 }