コード例 #1
0
 public Acceptor(ITcpServer tcpServer, JobProcessor thread)
 {
     this.acceptor           = tcpServer;
     this.Thread             = thread;
     this.MessageHandler     = new MessageHandlerFactory();
     this.PipeMessageHandler = new MessageHandlerFactory();
     this.RegisterNonPipeMessageGroup(Message.TypeConverters);
     this.acceptor.ClientAccept   += this.acceptor_ClientAccept;
     this.acceptor.ExceptionOccur += this.acceptor_ExceptionOccur;
     this.acceptor.DoOnHugeMessage = delegate(int size, string msg)
     {
         string log = string.Format("<HugeMessage> [{2}]Service Acceptor get huge size packet {0} :{1}", size, msg, this.EndPointAddress);
         try
         {
             FileLog.Log("HugeMessage.log", log);
         }
         catch (Exception)
         {
         }
     };
     this.acceptor.WriteLogFunc = delegate(string msg)
     {
         string log = string.Format("[Acceptor][{0}]{1}", this.acceptor.LocalEndPoint, msg);
         try
         {
             FileLog.Log("Peer.log", log);
         }
         catch (Exception)
         {
         }
     };
 }
コード例 #2
0
    public IntegUnitTests(TestServerAppCoreEntryPointCfg fixture)
    {
        //preparing and establishing TCP connection
        ILifetimeScope container = fixture.Configure();

        _tcpServer = container.Resolve <ITcpServer>();
        _tcpClient = container.Resolve <TcpClient>();

        var prefs = container.Resolve <ISocketPrefs>();

        _tcpServer.Start();

        _tcpClient.Connect(prefs.IpAddress, prefs.PortNumber);

        var isConnected = _tcpClient.Connected;

        var clientStream = _tcpClient.GetStream();

        _sWriter = new StreamWriter(clientStream, Encoding.ASCII)
        {
            AutoFlush = true
        };
        _sReader = new StreamReader(clientStream, Encoding.ASCII);

        _sWriter.WriteLine("TestUser");
        _sWriter.WriteLine(Guid.NewGuid().ToString());

        _sReader.ReadLine();
    }
コード例 #3
0
 private void ThrowIfRelatedServerIsNull(ITcpServer relatedTcpServer)
 {
     if (relatedTcpServer is null)
     {
         throw new ArgumentNullException(nameof(relatedTcpServer));
     }
 }
コード例 #4
0
 private static void Check(ITcpServer server)
 {
     try
     {
         foreach (var item in server.Connections)
         {
             int ret = -1;
             try
             {
                 ret = item.Value.Send(new byte[0]);
             }
             catch (Exception ex)
             {
                 ret = -2;
                 Console.WriteLine(ex.Message);
             }
             finally
             {
                 Console.WriteLine($"{item.Key}:{ret}");
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
コード例 #5
0
        private Boolean ExecuteStartState(ref ITcpServer server, Object[] args)
        {
            const String serverStartFormat = "=================> Server was started on {0} : {1}";
            Boolean      result;

            if (args.Length >= 2 && (args[0] != null && args[1] != null))
            {
                String          ipAddress    = args[0] as String;
                UInt16          port         = Convert.ToUInt16(args[1]);
                String          settingsFile = args[2] as String;
                String          scriptFile   = args[3] as String;
                TcpServerConfig config       = settingsFile != null?TcpServerConfigBuilder.Build(settingsFile) : null;

                if (server == null || scriptFile != null)
                {
                    server = new FlexibleTcpServer(scriptFile, ipAddress, port, _logger, false, config);
                }
                result = server.Start(ipAddress, port);
                if (result)
                {
                    System.Console.WriteLine(serverStartFormat, ipAddress, port);
                }
                _currentState = result ? MachineState.Started : _currentState;
                return(result);
            }
            result = server.Start();
            if (result)
            {
                System.Console.WriteLine("=================> Server was started");
            }
            _currentState = result ? MachineState.Started : _currentState;
            return(result);
        }
コード例 #6
0
        public ProtocolParser(ITcpServer server, IProtocolContainer container)
        {
            m_server            = server;
            m_protocolContainer = container;

            m_server.OnReceiveHandle += ReceiveHandle;
        }
コード例 #7
0
        public PeerListService(IConfiguration configuration, ILoggable logger, IPeerList peers)
        {
            Configuration = configuration;
            Logger        = logger;
            Peers         = peers;

            if (MasterKey.Address != EndPoint.Address)
            {
                throw new ArgumentException("MasterKey enode mismatch");
            }

            // TCP server start
            Server = new TcpServer()
            {
                OnStart   = OnTcpStart,
                OnStop    = OnTcpStop,
                OnAccept  = OnTcpAccept,
                OnClose   = OnTcpClose,
                OnMessage = OnTcpMessage
            };

            commandLineInterpreter = new CommandLineInterpreter()
            {
                OnCommand = OnConsoleCommand
            };
        }
コード例 #8
0
        /// <summary>
        /// Constructor for ImageServer class
        /// </summary>
        /// <param name="logging">the logging service that will be connected to the image service</param>
        /// <param name="port">the port of the tcp server the constructor creates</param>
        public ImageServer(ILoggingService logging, int port)
        {
            m_logging = logging;
            IImageServiceModal modal = new ImageServiceModal();

            m_controller                      = new ImageController(modal);
            m_clientHandler                   = new ClientHandler(m_controller);
            m_TCPServer                       = new TcpServerChannel(port, m_clientHandler);
            m_handlerManager                  = HandlerManager.Instance;
            m_handlerManager.Logging          = m_logging;
            m_handlerManager.Controller       = m_controller;
            m_handlerManager.CommandRecieved += delegate(object sender, CommandRecievedEventArgs e)
            {
                switch (e.CommandID)
                {
                case (int)CommandEnum.RemoveHandler:
                    CommandMessage message = new CommandMessage
                    {
                        Status   = true,
                        Type     = CommandEnum.RemoveHandler,
                        Message  = @"Removed handler " + e.RequestDirPath,
                        Handlers = new string[] { e.RequestDirPath }
                    };
                    m_logging.Log(message.Message, LogMessageTypeEnum.INFO);
                    m_TCPServer.SendMessage(message.ToJSONString(), ServerMessageTypeEnum.CloseHandlerMessage);
                    break;

                default:
                    break;
                }
            };
            m_logStorage = LogStorage.Instance;
            m_logging.MessageRecieved += m_logStorage.AddLog;
        }
コード例 #9
0
ファイル: ImageServer.cs プロジェクト: yifrach/ImageService
        /// <summary>
        /// the constructor get Icontroller and Ilogging, take the two paths to directories
        /// that we need to listen from the APP config,
        /// create handlers for the directrories and notify the logging.
        /// </summary>
        /// <param name="controller">the controller that we paa to the handler</param>
        /// <param name="logging">the logging incharge to notify the user about the process</param>
        public ImageServer(IImageController controller, ILoggingService logging, int imagesCounter)
        {
            this.imagesCounter = imagesCounter;
            this.handlers      = new Dictionary <string, IDirectoryHandler>();
            this.m_controller  = controller;
            this.m_logging     = logging;

            string[] directories = (ConfigurationManager.AppSettings.Get("Handler").Split(';'));
            this.m_tcpServer = new TcpServer();
            this.m_tcpServer.DataReceived += ExecuteTcpServer;
            foreach (string path in directories)
            {
                try
                {
                    IDirectoryHandler handler = new DirectoyHandler(m_logging, m_controller, m_tcpServer);
                    CommandRecieved += handler.OnCommandRecieved;
                    CloseService    += handler.onCloseService;
                    handler.StartHandleDirectory(path);
                    this.m_logging.Log("Handler created for " + path, Logging.Modal.MessageTypeEnum.INFO);
                    this.handlers[path] = handler;
                }
                catch (Exception e)
                {
                    this.m_logging.Log("Error creating handler for the directory: " + path + " " + e.ToString(), Logging.Modal.MessageTypeEnum.INFO);
                }
            }

            this.m_tcpServer.Start();
        }
コード例 #10
0
 public PanelPresenter(AlarmMonitorContext Context)
 {
     this._context     = Context;
     this.eventService = new EventService(_context.GetEventRepository(), _context.GetEventUnitRepository());
     this.panelService = new PanelService(_context.GetPanelRepository());
     this.tcpServer    = new TcpServer(new EventServiceApplication(this.eventService, this.panelService));
     this.tcpServer.Setup();
 }
コード例 #11
0
        private static void SendVmTerminatingMessage(ITcpServer server, int port)
        {
            var client = new NetClient(new ClientFeedback());

            client.Connect("127.0.0.1", port);
            client.SendAndWait(new VMTerminating(server.Port));
            client.Disconnect();
        }
コード例 #12
0
ファイル: Form1.cs プロジェクト: jaii3/Communication
        private async void Form1_Load(object sender, EventArgs e)
        {
            tcpServer = new TcpServer("127.0.0.1", 7779);
            await tcpServer.StartAsync();

            tcpServer.OnReceiveOriginalDataFromTcpClient += TcpServer_ReceiveOriginalDataFromTcpClient;
            tcpServer.OnClientConnect    += TcpServer_ClientConnect;
            tcpServer.OnClientDisconnect += TcpServer_ClientDisconnect;
        }
コード例 #13
0
ファイル: MidgeUsersManager.cs プロジェクト: Grizley56/Midge
        public MidgeUsersManager([NotNull] ITcpServer server)
        {
            _server                  = server;
            _onlineUsers             = new ConcurrentDictionary <IClientConnection, MidgeUser>();
            server.ConnectionOpened += ServerConnectionOpened;
            server.ConnectionClosed += ServerConnectionClosed;

            Init();
        }
コード例 #14
0
        public Controller(ILoggerFactory loggerFactory, ITcpServer server, IClient client)
            : base(loggerFactory)
        {
            Server = server ?? throw new ArgumentNullException(nameof(server));
            Client = client ?? throw new ArgumentNullException(nameof(client));
            _hub   = Hub.Default ?? throw new InvalidOperationException($"The PubSub Hub does not have a default hub - {nameof(Hub)}");

            StopToken = new CancellationTokenSource();
        }
コード例 #15
0
        private static void SendVmInitializedMessage(Guid correlationId, ITcpServer server, int port)
        {
            var client = new NetClient(new ClientFeedback());

            client.Connect("127.0.0.1", port);
            Logger.WriteDebug(string.Format("About to send VMInitializedMessage for 127.0.0.1:{0}", server.Port));
            client.SendAndWait(new VMInitializedMessage(correlationId, Process.GetCurrentProcess().Id, server.Port, _engine.GetNUnitTestRunner(), _engine.GetMSTestRunner(), _engine.IsLoggingEnabled(), _engine.StartedPaused));
            client.Disconnect();
        }
コード例 #16
0
        public PFireServer(IPFireDatabase pFireDatabase, IXFireClientManager xFireClientManager, ITcpServer server)
        {
            Database       = pFireDatabase;
            _clientManager = xFireClientManager;

            _server                  = server;
            _server.OnReceive       += HandleRequest;
            _server.OnConnection    += HandleNewConnection;
            _server.OnDisconnection += OnDisconnection;
        }
コード例 #17
0
 public NetworkManager(ITcpServer tcpServer, IHashRepository hashRepository, IHashLoader hashLoader,
                       [Named("GameUserRepository")] IUserRepository gameUserRepository,
                       [Named("PendingUserRepository")] IUserRepository pendingUserRepository)
 {
     Server             = (TcpServer)tcpServer;
     _hashRepository    = (HashRepository)hashRepository;
     _hashLoader        = (HashLoader)hashLoader;
     _userRepository    = (GameUserRepository)gameUserRepository;
     _pendingRepository = (PendingUserRepository)pendingUserRepository;
 }
コード例 #18
0
ファイル: GameHost.cs プロジェクト: will63004/BattleServer
 public GameHost(IServerDefine serverDefine,
                 ITcpServer server,
                 IMongoClient mongoClient,
                 GrpcSetUp grpcSetUp)
 {
     this.serverDefine = serverDefine;
     this.server       = server;
     this.mongoClient  = mongoClient;
     this.grpcSetUp    = grpcSetUp;
 }
コード例 #19
0
        private Boolean ExecuteStartState(ref ITcpServer server, Object[] args)
        {
            const String serverStartFormat = "=================> Server was started on {0} : {1}";
            Boolean      result;

            if (args.Length >= 2 && (args[0] != null && args[1] != null))
            {
                String ipAddress = args[0] as String;
                if (!String.IsNullOrEmpty(ipAddress))
                {
                    _ipAddress = ipAddress;
                }
                UInt16 port = Convert.ToUInt16(args[1]);
                _port = port;
                String settingsFile = args[2] as String;
                String scriptFile   = args[3] as String;
                if (!String.IsNullOrEmpty(scriptFile))
                {
                    _scriptFile = scriptFile;
                }
                String          compilerOptionFile = args[4] as String;
                CompilerOptions compilerOptions    = compilerOptionFile != null?CompilerOptionsBuilder.Build(compilerOptionFile) : null;

                TcpServerConfig config = settingsFile != null?TcpServerConfigBuilder.Build(settingsFile) : null;

                if (compilerOptions != null)
                {
                    _compilerOptions = compilerOptions;
                }
                if (config != null)
                {
                    _config = config;
                }
                if (server == null || scriptFile != null || compilerOptionFile != null)
                {
                    //System.Console.WriteLine("tcp server re-creation....");
                    server = new FlexibleTcpServer(_scriptFile, _ipAddress, _port, _compilerOptions, _logger, false, _config);
                }
                result = server.Start(_ipAddress, _port);
                if (result)
                {
                    System.Console.WriteLine(serverStartFormat, _ipAddress, _port);
                }
                _currentState = result ? MachineState.Started : _currentState;
                return(result);
            }
            server = new FlexibleTcpServer(_scriptFile, _ipAddress, _port, _compilerOptions, _logger, false, _config);
            result = server.Start();
            if (result)
            {
                System.Console.WriteLine("=================> Server was started");
            }
            _currentState = result ? MachineState.Started : _currentState;
            return(result);
        }
コード例 #20
0
ファイル: HTTPClients.cs プロジェクト: ViPetroFF/zcahttpproxy
        public HttpClient(ITcpServer server, Socket socket, TcpListener listener)
        {
            _server = server;
            _socket = socket;
            _listener = listener;
            _iIndex = _server.AddNewSocket(_socket, _listener);
            _stream = new NetworkStream(_socket, false);
            _RemoteEndPoint = (IPEndPoint)_socket.RemoteEndPoint;

            WriteLogNewConnection();
        }
コード例 #21
0
        public CommandSystem(IProtocolParser protocolParser, ITcpServer server)
        {
            m_protocolParser = protocolParser;

            m_commandContainer = new Dictionary <string, ICommand>();

            //m_commandContainer.Add("Stop Service", new StopService());
            m_commandContainer.Add("Show Command Code", this);
            m_commandContainer.Add("Send HeartBeat", new SendHeartBeat(protocolParser));
            m_commandContainer.Add("ShutdownClient", new ShutdownClient(server));
            m_commandContainer.Add("Send LoginAck", new SendLoginAck(protocolParser));
        }
コード例 #22
0
ファイル: Application.cs プロジェクト: vlindos/Vlindos
 public Application(
     IApplicationArgumentsGetter applicationArgumentsGetter,
     ILoggingSystemInitializer loggingSystemInitializer,
     IFileReader <Configuration.Configuration> configurationReader,
     ITcpServer tcpServer, IHttpRequestProcessor httpRequestProcessor)
 {
     _applicationArgumentsGetter = applicationArgumentsGetter;
     _loggingSystemInitializer   = loggingSystemInitializer;
     _configurationReader        = configurationReader;
     _tcpServer            = tcpServer;
     _httpRequestProcessor = httpRequestProcessor;
 }
コード例 #23
0
 private Boolean ExecuteStopState(ref ITcpServer server, Object[] args)
 {
     if (server == null)
     {
         System.Console.WriteLine("Server instance is null");
         return(false);
     }
     server.Stop(true);
     _currentState = MachineState.Stopped;
     System.Console.WriteLine("=================> Server was stoped");
     return(true);
 }
コード例 #24
0
ファイル: Application.cs プロジェクト: vlindos/Vlindos
 public Application(
     IApplicationArgumentsGetter applicationArgumentsGetter,
     ILoggingSystemInitializer loggingSystemInitializer,
     IFileReader<Configuration.Configuration> configurationReader,
     ITcpServer tcpServer, IHttpRequestProcessor httpRequestProcessor)
 {
     _applicationArgumentsGetter = applicationArgumentsGetter;
     _loggingSystemInitializer = loggingSystemInitializer;
     _configurationReader = configurationReader;
     _tcpServer = tcpServer;
     _httpRequestProcessor = httpRequestProcessor;
 }
コード例 #25
0
 public void Init(ref ITcpServer server)
 {
     if (server == null)
     {
         throw new NullReferenceException("server");
     }
     _server           = server;
     _connectHandlerId = Guid.NewGuid();
     _dataHandlerId    = Guid.NewGuid();
     //Console.WriteLine("Init....");
     _server.AddConnectionHandler(_connectHandlerId, OnClientConnection);
     _server.AddHandler(new TcpClientHandlerInfo(_dataHandlerId), OnClientExchange);
 }
コード例 #26
0
        /// <summary>
        /// Handles the contents of a network message.
        /// </summary>
        /// <param name="server">A reference to the tcp server instance which owns the listener at which this request landed.</param>
        /// <param name="incomingPacket">The packet to handle.</param>
        /// <param name="client">A reference to the client from where this request originated from, for context.</param>
        /// <returns>A collection of <see cref="IOutboundPacket"/>s that compose that synchronous response, if any.</returns>
        public override IEnumerable <IOutboundPacket> HandleRequestPacket(ITcpServer server, IInboundPacket incomingPacket, IClient client)
        {
            server.ThrowIfNull(nameof(server));
            incomingPacket.ThrowIfNull(nameof(incomingPacket));
            client.ThrowIfNull(nameof(client));

            if (!(incomingPacket is IGameLogInInfo loginInfo))
            {
                this.Logger.LogError($"Expected packet info of type {nameof(IGameLogInInfo)} but got {incomingPacket.GetType().Name}.");

                return(null);
            }

            if (!(client.Connection is ISocketConnection socketConnection))
            {
                this.Logger.LogError($"Expected a {nameof(ISocketConnection)} got a {client.Connection.GetType().Name}.");

                return(null);
            }

            // Associate the xTea key to allow future validate packets from this connection.
            socketConnection.SetupAuthenticationKey(loginInfo.XteaKey);

            // TODO: possibly a friendly name conversion here. Also, the actual values might change per version, so this really should be set by the packet reader.
            client.Type    = Enum.IsDefined(typeof(AgentType), loginInfo.ClientOs) ? (AgentType)loginInfo.ClientOs : AgentType.Windows;
            client.Version = loginInfo.ClientVersion.ToString();

            if (loginInfo.ClientVersion != server.Options.SupportedClientVersion.Numeric)
            {
                this.Logger.LogInformation($"Client attempted to connect with version: {loginInfo.ClientVersion}, OS: {loginInfo.ClientOs}. Expected version: {server.Options.SupportedClientVersion.Numeric}.");

                // TODO: hardcoded messages.
                return(new GameServerDisconnectPacket($"You need client version {server.Options.SupportedClientVersion.Description} to connect to this server.").YieldSingleItem());
            }

            var(playerId, error) = server.RequestPlayerLogIn(loginInfo.AccountIdentifier, loginInfo.Password, loginInfo.CharacterName);

            if (!string.IsNullOrWhiteSpace(error))
            {
                return(new GatewayServerDisconnectPacket(error).YieldSingleItem());
            }

            client.PlayerId = playerId;

            this.clientsManager.Register(client);

            // We don't return anything synchronously in this particular case, the game will send out the login notifications when they are ready.
            return(null);
        }
コード例 #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NetServerEventArgs"/> class.
 /// </summary>
 /// <param name="tcpServer">The TCP server.</param>
 /// <param name="localEndPoint">The local end point.</param>
 /// <param name="connection">The connection.</param>
 public NetServerEventArgs(ITcpServer tcpServer, IPEndPoint localEndPoint = null, ITcpConnection connection = null)
 {
     if (tcpServer != null)
     {
         TcpServer = tcpServer;
     }
     if (localEndPoint != null)
     {
         LocalEndPoint = localEndPoint;
     }
     if (connection != null)
     {
         Connection = connection;
     }
 }
コード例 #28
0
        private void Server_NewClientAccepted(ITcpServer listener, Socket client, object state)
        {
            IPAddress   ip    = ((IPEndPoint)client.RemoteEndPoint).Address;
            MachineItem mItem = FindMachineItemByMachineIP(ip.ToString());

            if (mItem != null)
            {
                IBar bar = FindBottomStatusIbarByMachineName(mItem.设备名称);
                if (bar != null)
                {
                    ICheckBar iCheckbar = bar as ICheckBar;
                    iCheckbar.bChecked = true;
                    //bar.BarStatus = new BarStatus() { BackColor = Color.DeepSkyBlue };
                }
            }
        }
コード例 #29
0
        private void Server_ClientDropped(ITcpServer listener, Socket client)
        {
            IPAddress   ip    = ((IPEndPoint)client.RemoteEndPoint).Address;
            MachineItem mItem = FindMachineItemByMachineIP(ip.ToString());

            if (mItem != null)
            {
                IBar bar = FindBottomStatusIbarByMachineName(mItem.设备名称);
                if (bar != null)
                {
                    ICheckBar iCheckbar = bar as ICheckBar;
                    iCheckbar.bChecked = false;
                    //bar.BarStatus = new BarStatus() { BackColor = Color.Tomato };
                }
            }
        }
コード例 #30
0
        /// <summary>
        /// Handles the contents of a network message.
        /// </summary>
        /// <param name="server">A reference to the tcp server instance which owns the listener at which this request landed.</param>
        /// <param name="incomingPacket">The packet to handle.</param>
        /// <param name="client">A reference to the client from where this request originated from, for context.</param>
        /// <returns>A collection of <see cref="IOutboundPacket"/>s that compose that synchronous response, if any.</returns>
        public override IEnumerable <IOutboundPacket> HandleRequestPacket(ITcpServer server, IInboundPacket incomingPacket, IClient client)
        {
            server.ThrowIfNull(nameof(server));
            incomingPacket.ThrowIfNull(nameof(incomingPacket));
            client.ThrowIfNull(nameof(client));

            if (!(incomingPacket is ISpeechInfo speechInfo))
            {
                this.Logger.LogError($"Expected packet info of type {nameof(ISpeechInfo)} but got {incomingPacket.GetType().Name}.");

                return(null);
            }

            server.RequestSendMessageAsync(client.PlayerId, speechInfo.SpeechType, speechInfo.ChannelType, speechInfo.Content, speechInfo.Receiver);

            return(null);
        }
コード例 #31
0
        /// <summary>
        /// Handles the contents of a network message.
        /// </summary>
        /// <param name="server">A reference to the tcp server instance which owns the listener at which this request landed.</param>
        /// <param name="incomingPacket">The packet to handle.</param>
        /// <param name="client">A reference to the client from where this request originated from, for context.</param>
        /// <returns>A collection of <see cref="IOutboundPacket"/>s that compose that synchronous response, if any.</returns>
        public override IEnumerable <IOutboundPacket> HandleRequestPacket(ITcpServer server, IInboundPacket incomingPacket, IClient client)
        {
            server.ThrowIfNull(nameof(server));
            incomingPacket.ThrowIfNull(nameof(incomingPacket));
            client.ThrowIfNull(nameof(client));

            if (!(incomingPacket is IModesInfo modesInfo))
            {
                this.Logger.LogError($"Expected packet info of type {nameof(IModesInfo)} but got {incomingPacket.GetType().Name}.");

                return(null);
            }

            server.RequestToUpdateModesAsync(client.PlayerId, modesInfo.FightMode, modesInfo.ChaseMode, modesInfo.SafeModeOn);

            return(null);
        }
コード例 #32
0
        /// <summary>
        /// Handles the contents of a network message.
        /// </summary>
        /// <param name="server">A reference to the tcp server instance which owns the listener at which this request landed.</param>
        /// <param name="incomingPacket">The packet to handle.</param>
        /// <param name="client">A reference to the client from where this request originated from, for context.</param>
        /// <returns>A collection of <see cref="IOutboundPacket"/>s that compose that synchronous response, if any.</returns>
        public override IEnumerable <IOutboundPacket> HandleRequestPacket(ITcpServer server, IInboundPacket incomingPacket, IClient client)
        {
            server.ThrowIfNull(nameof(server));
            incomingPacket.ThrowIfNull(nameof(incomingPacket));
            client.ThrowIfNull(nameof(client));

            if (!(incomingPacket is ILookAtInfo lookAtInfo))
            {
                this.Logger.LogError($"Expected packet info of type {nameof(ILookAtInfo)} but got {incomingPacket.GetType().Name}.");

                return(null);
            }

            server.RequestTextDescriptionAtAsync(client.PlayerId, lookAtInfo.Location, lookAtInfo.StackPosition, lookAtInfo.ThingId);

            return(null);
        }
コード例 #33
0
ファイル: TcpMonitor.cs プロジェクト: luohuazhiyu/sunsocket
 public void AddServer(ITcpServer Server)
 {
     ServerList.Add(Server);
 }
コード例 #34
0
ファイル: HTTPClients.cs プロジェクト: ViPetroFF/zcahttpproxy
 public CAHttpClient(ITcpServer server, Socket socket, TcpListener listener)
     : base(server, socket, listener)
 {
     _CAModule = (ICAModule)server;
     _StreamServer = (IStreamProxyServer)server;
     Start();
 }
コード例 #35
0
ファイル: VimEditor.cs プロジェクト: acken/EditorEngine
 public void Initialize(Location location, string[] args)
 {
     _server = null;
     _server = new TcpServer(Environment.NewLine);
     _server.IncomingMessage += Handle_serverIncomingMessage;
     _server.ClientConnected += Handle_serverClientConnected;
     _server.Start();
     Logger.Write("Server started and running on port {0}", _server.Port);
     _executable = getExecutable(args);
     _parameters = getParameters();
     if (_process != null)
         _process.Kill();
     _process = new Process();
     _process.StartInfo = new ProcessStartInfo(_executable, _parameters);
     _process.StartInfo.CreateNoWindow = true;
     _process.StartInfo.UseShellExecute = true;
     _process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
     _process.Start();
     listenForModifications();
     Thread.Sleep(500);
     _isInitialized = true;
     GoTo(location);
 }
コード例 #36
0
ファイル: SocketServer.cs プロジェクト: dogtbh/sensu-client
 public SocketServer(ITcpServer tcpServer,IUdpReceiver udpReceiver, ICheckProcessor checkProcessor)
 {
     _tcpServer = tcpServer;
     _udpReceiver = udpReceiver;
     _checkProcessor = checkProcessor;
 }
コード例 #37
0
ファイル: Program.cs プロジェクト: nosami/ContinuousTests
 private static void SendVmInitializedMessage(Guid correlationId, ITcpServer server, int port)
 {
     var client = new NetClient(new ClientFeedback());
     client.Connect("127.0.0.1", port);
     Logger.WriteDebug(string.Format("About to send VMInitializedMessage for 127.0.0.1:{0}", server.Port));
     client.SendAndWait(new VMInitializedMessage(correlationId, Process.GetCurrentProcess().Id, server.Port, _engine.GetNUnitTestRunner(), _engine.GetMSTestRunner(), _engine.IsLoggingEnabled(), _engine.StartedPaused));
     client.Disconnect();
 }
コード例 #38
0
ファイル: Program.cs プロジェクト: nosami/ContinuousTests
 private static void SendVmTerminatingMessage(ITcpServer server, int port)
 {
     var client = new NetClient(new ClientFeedback());
     client.Connect("127.0.0.1", port);
     client.SendAndWait(new VMTerminating(server.Port));
     client.Disconnect();
 }