protected override void OnExit(ExitEventArgs e) { //关闭所有网络相关服务 BroadcastClient.Stop(); BroadcastServer.Stop(); NetworkClient.Stop(); NetworkServer.Stop(); }
public static void Main(string[] args) { var data = Observable.Interval (TimeSpan.FromSeconds (1)) .Publish() .RefCount(); var server = new BroadcastServer<long> ("127.0.0.1", 9800, data); server.Start (); Console.WriteLine ("Server started. Press any key to stop."); Console.ReadKey (); server.Stop (); }
private void RoomCloseHandler() { MessageBox.Show("当前房间已关闭"); ChatUserInfos.Clear(); ChatRecords.Clear(); NetworkClient.Stop(); if (GlobalValue.IsRoomMaster) { GlobalValue.IsRoomMaster = false; BroadcastServer.Stop(); NetworkServer.Stop(); } GlobalValue.IsInRoom = false; MainWindow.VM.Status = "Not in room...."; }