/* * This static Class is the center of the System. * It holds all Resources except Thread and File. */ //加 static CU() { SET_UDP = new UDPSetting(); MG_UDP = new UDPManager(SET_UDP); MG_User = new UserManager(); Player = new Player(); MG_Page = new SceneManager(); }
private void LoadUDP() { UDP = new UDPSetting(); UDP.Port = Int32.Parse(App["udp"]["port"]); UDP.BufferSize = Int32.Parse(App["udp"]["port"]); UDPOffset = FileManager.GetOffset(); }
private void InitClient(UDPSetting setting) { if (client != null) { Close(); } client = new UdpClient(setting.Port); client.Client.ReceiveTimeout = setting.TimeOut; client.Client.SendTimeout = setting.TimeOut; clientEndPoint = new IPEndPoint(setting.IP, setting.Port); if (setting.BufferSize > 0) { client.Client.ReceiveBufferSize = setting.BufferSize; } }
private void InitServer(UDPSetting setting) { serverEndPoint = new IPEndPoint(setting.ServerIP, setting.ServerPort); }
private void InitUDP(UDPSetting setting) { InitClient(setting); InitServer(setting); }
private IPEndPoint serverEndPoint; // 接收目标或发送目标一律视为服务端 public UDP(UDPSetting setting) { this.setting = setting; }
public UDPManager(UDPSetting setting) { this.udpSetting = setting; this.udp = new UDP(setting); get_offset = FileManager.GetOffset(); }