Пример #1
0
        private static IProjectManagerImpl.Client InitializeClient()
        {
            var transport = new TSocket("localhost", Settings.RPCPort);
            var protocol = new BinaryProtocol(transport);
            var client = new IProjectManagerImpl.Client(protocol);

            for (var i = 0; i < Settings.MaxRetries; i++)
            {
                transport.Open();
                if (transport.Peek()) break;
            }

            return client;
        }
Пример #2
0
 protected override TTransport AcceptImpl()
 {
     if (server == null)
     {
         throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket.");
     }
     try
     {
         TcpClient result = server.AcceptTcpClient();
         TSocket result2 = new TSocket(result);
     try
     {
       result2 = new TSocket(result);
       result2.Timeout = clientTimeout;
       if (useBufferedSockets)
       {
     TBufferedTransport result3 = new TBufferedTransport(result2);
     return result3;
       }
       else
       {
     return result2;
       }
     }
     catch (System.Exception)
     {
       // If a TSocket was successfully created, then let
       // it do proper cleanup of the TcpClient object.
       if (result2 != null)
     result2.Dispose();
       else //  Otherwise, clean it up ourselves.
     ((IDisposable)result).Dispose();
       throw;
     }
       }
       catch (Exception ex)
       {
     throw new TTransportException(ex.ToString());
       }
 }