public override void Go() { var server = new MessagingServer.Server(S); //server.Inject(new WebSocketServer.ServerExtension()); var managerExt = new ManagerServiceExtension(); managerExt.Main(S); server.Start(); }
public TcpSocketClient(MessagingServer.Server messagingServer) { _dataProvider = new CommonJsonDataProvider(messagingServer); _messagingServer = messagingServer; }
public void Start(MessagingServer.Server server) { ServerInstance = new Server(new SocketServerContext(server)); ServerInstance.Start(); }
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(); }
public WebSocketServerContext(MessagingServer.Server server, IPAddress ipAddress, short port) { MessageServer = server; IpAddress = ipAddress; Port = port; }
public WebSocketServerContext(MessagingServer.Server server) : this(server, IPAddress.Any, 9992) { MessageServer = server; }
public SocketServerContext(MessagingServer.Server server) { MessagingServer = server; ServerContext = server.ServerContext; }
public SocketServerContext(MessagingServer.Server server, IPAddress ipAddress, short portNumber) : this(server) { IpAddress = ipAddress; PortNumber = portNumber; }
public SocketClientContext(MessagingServer.Server messagingServer, IPEndPoint ipEndPoint) { MessagingServer = messagingServer; IpEndPoint = ipEndPoint; }