コード例 #1
0
ファイル: Client.cs プロジェクト: spikensbror-dotnet/nsonic
 public void Connect()
 {
     if (!this.tcpClient.Connected)
     {
         this.Environment = this.connector.Connect(this, this.tcpClient, this.configuration);
     }
 }
コード例 #2
0
ファイル: Client.cs プロジェクト: spikensbror-dotnet/nsonic
 public async Task ConnectAsync()
 {
     if (!this.tcpClient.Connected)
     {
         this.Environment = await this.connector.ConnectAsync(this, this.tcpClient, this.configuration);
     }
 }
コード例 #3
0
        public SonicSession(ITcpClient client, SemaphoreSlim semaphore, EnvironmentResponse environment)
        {
            this.semaphore = semaphore;

            // As long as the session is alive, it should carry an exclusive lock of the TCP client
            // to prevent operations across threads.
            this.semaphore.Wait();

            this.Client      = client;
            this.Environment = environment;
        }
コード例 #4
0
 public ISonicSession Create(EnvironmentResponse environment)
 {
     return(new SonicSession(this.client, this.semaphore, environment));
 }