Exemple #1
0
        private void StartTCPServer()
        {
            SimpleTcpServer tcpServer = new SimpleTcpServer(rpcProgram.GetPort(), rpcProgram,
                                                            0);

            rpcProgram.StartDaemons();
            try
            {
                tcpServer.Run();
            }
            catch (Exception e)
            {
                Log.Fatal("Failed to start the TCP server.", e);
                if (tcpServer.GetBoundPort() > 0)
                {
                    rpcProgram.Unregister(PortmapMapping.TransportTcp, tcpServer.GetBoundPort());
                }
                tcpServer.Shutdown();
                ExitUtil.Terminate(1, e);
            }
            nfsBoundPort = tcpServer.GetBoundPort();
        }