コード例 #1
0
        public override void Go()
        {
            var server = new MessagingServer.Server(S);
            //server.Inject(new WebSocketServer.ServerExtension());

            var managerExt = new ManagerServiceExtension();

            managerExt.Main(S);

            server.Start();
        }
コード例 #2
0
ファイル: TcpSocketClient.cs プロジェクト: renwoox/prime
 public TcpSocketClient(MessagingServer.Server messagingServer)
 {
     _dataProvider    = new CommonJsonDataProvider(messagingServer);
     _messagingServer = messagingServer;
 }
コード例 #3
0
 public void Start(MessagingServer.Server server)
 {
     ServerInstance = new Server(new SocketServerContext(server));
     ServerInstance.Start();
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: renwoox/prime
        static void Main(string[] args)
        {
            var logger = new ConsoleLogger()
            {
                IncludePreamble = true
            };

            logger.Log("Operating system: " + Environment.OSVersion.Platform);
            logger.Log("Current directory: " + Environment.CurrentDirectory);

            logger.Log("Prime.Manager started");

            var serverContext = new ServerContext()
            {
                L = logger
            };

            var messagingServer = new MessagingServer.Server(serverContext);
            var clientExcension = new SocketClient.ServerExtension();

            messagingServer.Inject(clientExcension);

            messagingServer.Start();

            var managerExtension = new ManagerServiceExtension();

            managerExtension.Main(serverContext);

            Console.ReadLine();

            //////////////// OLD /////////////

            //var logger = new ConsoleLogger() { IncludePreamble = true };

            //logger.Log("Operating system: " + Environment.OSVersion.Platform);
            //logger.Log("Current directory: " + Environment.CurrentDirectory);

            //logger.Log("Prime.Manager started");

            //var client = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            //logger.Log("Establishing connection to local socket server.");
            //client.Connect("127.0.0.1", 9991);

            //// TODO: Alyasko: implement TCP client here.

            ////var server = new MessagingServer.Server();

            //var settings = new JsonSerializerSettings()
            //{
            //    TypeNameHandling = TypeNameHandling.Objects,
            //    //SerializationBinder = server.TypeBinder
            //};

            //var dataString = "";//JsonConvert.SerializeObject(msg, settings);

            //logger.Log("Connection established, sending message: " + dataString);

            //var dataBytes = dataString.GetBytes();

            //client.Send(dataBytes);

            //Task.Run(() =>
            //{
            //    var helper = new MessageTypedSender(null); // TODO: Alyasko: fix this.

            //    do
            //    {
            //        var buffer = new byte[1024];
            //        var iRx = client.Receive(buffer);
            //        var recv = buffer.GetString().Substring(0, iRx);

            //        if (string.IsNullOrWhiteSpace(recv))
            //            continue;

            //        if (JsonConvert.DeserializeObject(recv, settings) is BaseTransportMessage m)
            //            helper.UnPackSendReceivedMessage(new ExternalMessage(m.SessionId, m));

            //    } while (client.Connected);
            //});

            //Console.ReadLine();
        }
コード例 #5
0
 public WebSocketServerContext(MessagingServer.Server server, IPAddress ipAddress, short port)
 {
     MessageServer = server;
     IpAddress     = ipAddress;
     Port          = port;
 }
コード例 #6
0
 public WebSocketServerContext(MessagingServer.Server server) : this(server, IPAddress.Any, 9992)
 {
     MessageServer = server;
 }
コード例 #7
0
ファイル: SocketServerContext.cs プロジェクト: renwoox/prime
 public SocketServerContext(MessagingServer.Server server)
 {
     MessagingServer = server;
     ServerContext   = server.ServerContext;
 }
コード例 #8
0
ファイル: SocketServerContext.cs プロジェクト: renwoox/prime
 public SocketServerContext(MessagingServer.Server server, IPAddress ipAddress, short portNumber) : this(server)
 {
     IpAddress  = ipAddress;
     PortNumber = portNumber;
 }
コード例 #9
0
 public SocketClientContext(MessagingServer.Server messagingServer, IPEndPoint ipEndPoint)
 {
     MessagingServer = messagingServer;
     IpEndPoint      = ipEndPoint;
 }