Exemple #1
0
 internal ClientSocket(Socket socket,
                       OnConnectionStateChangedHandler connectionStateChanged,
                       OnSocketShutdownHandler shutdown,
                       OnSendFinishedHandler sendfinished,
                       OnDataReceivedHandler dataReceive
                       ) : base(ClientSocketConfiguration.FromSocket(socket))
 {
     _socket = socket ?? throw new ArgumentNullException(nameof(socket));
     OnConnectionStateChanged += connectionStateChanged;
     OnSocketShutdown         += shutdown;
     OnSendFinished           += sendfinished;
     OnRawDataReceived        += dataReceive;
     Task.Factory.StartNew(() =>
     {
         PublishConnectionStateChanged(true);
         StartReceive();
     }, TaskCreationOptions.LongRunning);
 }
Exemple #2
0
 public ClientSocket(ClientSocketConfiguration configuration) : base(configuration)
 {
     _config = configuration;
 }
Exemple #3
0
 public ClientSocket(ClientSocketConfiguration configuration) : base(configuration)
 {
     Init();
 }
Exemple #4
0
 public ClientSocket(ClientSocketConfiguration configuration, ILoggerFactory loggerFactory) : base(configuration, loggerFactory?.CreateLogger <ClientSocket>()) => _config = configuration;