mirror of
https://e.coding.net/circlecloud/SixiBroadcast.git
synced 2025-11-24 23:56:05 +00:00
修改监听为后台线程...
This commit is contained in:
@@ -33,9 +33,11 @@ namespace UDPClient
|
||||
endpoint = new IPEndPoint(IPAddress.Any, 0);
|
||||
//启动客户端监听
|
||||
Thread t = new Thread(new ThreadStart(ClientThread));
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
//启动Web监听
|
||||
Thread w = new Thread(new ThreadStart(WebListen));
|
||||
w.IsBackground = true;
|
||||
w.Start();
|
||||
//初始化Timer
|
||||
tmr.Interval = 390;
|
||||
@@ -77,7 +79,7 @@ namespace UDPClient
|
||||
{
|
||||
HttpListener listerner = new HttpListener();
|
||||
listerner.AuthenticationSchemes = AuthenticationSchemes.Anonymous;//指定身份验证 Anonymous匿名访问
|
||||
listerner.Prefixes.Add("http://127.0.0.1:25330/web/");
|
||||
listerner.Prefixes.Add("http://127.0.0.1:2533/web/");
|
||||
listerner.Start();
|
||||
Console.WriteLine("WebServer Start Successed.......");
|
||||
while (true)
|
||||
@@ -94,6 +96,7 @@ namespace UDPClient
|
||||
Console.WriteLine(str);
|
||||
byte[] buf = Encoding.Default.GetBytes(str);
|
||||
client.Send(buf, buf.Length, new IPEndPoint(IPAddress.Parse("127.0.0.1"), 25433));
|
||||
|
||||
}
|
||||
ctx.Response.Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user