2024年3月9日发(作者:)
33 {
34 ();
35 }
36 catch { }
37 }
38
39 private void ProcessThread()
40 {
41 server = new Socket(etwork, , );
42 (new oint((ip), port));
43 (count);
44 while (true)
45 {
46 try
47 {
48 Socket client = ();
49 serWorkItem(new WaitCallback(ListenExecute), client);
50 }
51 catch { }
52 finally
53 {
54 }
55 }
56 }
57
58 private void ListenExecute(object obj)
59 {
60 Socket client = obj as Socket;
61 try
62 {
63 string ip = (EndPoint as oint).ng();
64 byte[] buffer = new byte[1024];
65 int count = e(buffer);
66 if (count > 0)
67 {
68 string content = ing(buffer, 0, count);
69
70 // 解析 content
71 Regex actionRegex = new Regex(@"GETs+/(?
72 string action = (content).Groups["action"].Value;
73 string args = (content).Groups["args"].Value;
74 string headStr = @"HTTP/1.0 200 OK
75 Content-Type: text/html
76 Connection: keep-alive
77 Content-Encoding: utf-8
78
79 ";
80 if (Handler != null)
81 {
82 try
83 {
84 string result = Handler(action, args);
85 string data = (headStr + result);
86 (es(data));
87 }
88 catch { }
89 finally
90 {
91 }
92 }
93 else
94 {
95 string data = (headStr + DefaultReturn);
96 (es(data));
97 }


发布评论