コード例 #1
0
        static void Main()
        {
            try
            {
                //String gameDirectory = @"C:\Users\Jonathan Marler\Desktop\CastleDoctrine_v31";
                //String gameDirectory = @"D:\Tools\CastleDoctrine_v32";
                String gameDirectory = Environment.CurrentDirectory;

                String cdServerHostname = "thecastledoctrine.net";
                //String cdServerConnectorString = "gateway:proxy.houston.hp.com:8080%thecastledoctrine.net";


                //
                // Initialize Static Variables
                //
                CDLoader.Load(gameDirectory);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                houseViewerForm = new HouseViewerForm();

                //
                // Setup WebProxy
                //
                ISocketConnector cdConnector = CDProxy.SetupProxyInterceptor(gameDirectory);


                //
                // Start the listen thread
                //
                EndPoint           cdServerEndPoint = EndPoints.EndPointFromIPOrHost(cdServerHostname, 80);
                GameClientAcceptor acceptor         = new GameClientAcceptor(cdServerEndPoint, cdConnector);
                selectServer = new TcpSelectServer2(new Byte[2048], new TcpSelectListener2[] {
                    new TcpSelectListener2(new IPEndPoint(IPAddress.Any, 80), 32, acceptor.Accept),
                });

                acceptor.selectServer = selectServer;

                Thread listenThread = new Thread(selectServer.Run);
                listenThread.Name = "ListenThread";
                listenThread.Start();

                Application.Run(houseViewerForm);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            finally
            {
                CDProxy.RestoreProxy();
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Expected 2 arguments but got {0}", args.Length);
                Usage();
                return;
            }

            String ipOrHost = args[0];
            UInt16 port     = UInt16.Parse(args[1]);

            EndPoint serverEndPoint = EndPoints.EndPointFromIPOrHost(ipOrHost, port);

            RawControlExample(serverEndPoint);
            UsingAutogeneratedClientExample(serverEndPoint);
        }