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(); } }
private void InitConnector() { if (ServerConfig.ControlMode == ControlMode.Loop || ServerConfig.ControlMode == ControlMode.Self || ServerConfig.ControlMode == ControlMode.Parallel) { _SocketConnector = new SocketConnector(); _SocketConnector.NewClientConnected += tcpSocketListener_NewClientAccepted; _SocketConnector.Error += tcpSocketListener_Error; _SocketConnector.Setup(this); _SocketConnector.Start(); } }
private void CloseBrokerConnection() { if (_ioHandler != null) { _ioHandler.Dispose(); _ioHandler = null; } if (_connector != null) { _connector.Dispose(); _connector = null; } }
private IoHandler MakeBrokerConnection(IBrokerInfo broker, AMQConnection connection) { if (broker.UseSSL) { _connector = new SslSocketConnector(); } else { _connector = new SocketConnector(); } Stream stream = _connector.Connect(broker); return(new IoHandler(stream, connection.ProtocolListener)); }
SocketPeerConnection(Uri uri, ISocketConnector connector, Socket socket, bool isIncoming) { if (uri == null) { var endpoint = (IPEndPoint)socket.RemoteEndPoint; uri = new Uri($"{(socket.AddressFamily == AddressFamily.InterNetwork ? "ipv4" : "ipv6") }://{endpoint.Address}{':'}{endpoint.Port}"); } ConnectCancellation = new CancellationTokenSource(); Connector = connector; EndPoint = new IPEndPoint(IPAddress.Parse(uri.Host), uri.Port); IsIncoming = isIncoming; Socket = socket; Uri = uri; ReceiveTcs = new ReusableTaskCompletionSource <int> (); SendTcs = new ReusableTaskCompletionSource <int> (); }
public SocketPeerConnection(Uri uri, ISocketConnector connector) : this(uri, connector, null, false) { }
private void CloseBrokerConnection() { if ( _ioHandler != null ) { _ioHandler.Dispose(); _ioHandler = null; } if ( _connector != null ) { _connector.Dispose(); _connector = null; } }
private IoHandler MakeBrokerConnection(IBrokerInfo broker, AMQConnection connection) { if ( broker.UseSSL ) { _connector = new SslSocketConnector(); } else { _connector = new SocketConnector(); } Stream stream = _connector.Connect(broker); return new IoHandler(stream, connection.ProtocolListener); }
public GameClientAcceptor(EndPoint cdServerEndPoint, ISocketConnector connector) { this.cdServerEndPoint = cdServerEndPoint; this.connector = connector; }