Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     server = new AsyncSocketUDPServer();
     server.Start();
     listenBtn.Content = "服务开启...";
 }