public void Start() { //udp socket server 配置 int sport = Convert.ToInt32(ConfigMgr.GetAppConfig("UdpServerPort")); int cport = Convert.ToInt32(ConfigMgr.GetAppConfig("UdpClientPort")); int maxClient = Convert.ToInt32(ConfigMgr.GetAppConfig("UdpServermaxClient")); string ip = ConfigMgr.GetAppConfig("UdpServerIP"); server = new AsyncSocketUDPServer(IPAddress.Parse(ip), sport, cport, maxClient); server.DataReceived += server_OnDataReceived; //开始udp SOCKET 服务 server.Start(); }
private void Button_Click(object sender, RoutedEventArgs e) { server = new AsyncSocketUDPServer(); server.Start(); listenBtn.Content = "服务开启..."; }