public void Start(string ip, int port) { m_server = new SSyncServer(ip, port); this.m_server.OnClientConnected += m_server_OnClientConnected; this.m_server.OnServerStarted += m_server_OnServerStarted; this.m_server.OnServerFailedToStart += m_server_OnServerFailedToStart; m_server.Start(); }
static void Main(string[] args) { SSyncCore.OnProtocolLoaded += SSyncCore_OnProtocolLoaded; SSyncCore.Initialize(Assembly.GetAssembly(typeof(ChatRequestMessage)), Assembly.GetExecutingAssembly()); StartupManager.OnItemLoading += StartupManager_OnItemLoaded; StartupManager.OnStartupEnded += StartupManager_OnStartupEnded; StartupManager.Initialize(Assembly.GetExecutingAssembly()); SSyncServer serv = new SSyncServer("127.0.0.1", 500); serv.OnClientConnected += serv_OnSocketAccepted; serv.Start(); loop: string str = Console.ReadLine(); Clients.ForEach(x => x.Send(new ChatMessage(str))); Console.WriteLine(str + " Sended to clients"); goto loop; }