I’m writing a c# changing password page. I haven’t done much Socket
programming,and I am not sure the best way to go about it.
必须有控制台应用程序(服务器)和带有以下文本框的html页面(客户端):
Username [_______] Old password [______] New password [______] [Submit]
当用户点击提交然后,将创建一个新线程,我正在检查信息是否良好并且某些功能将被执行.
这应该接受来自定义端口上的多个客户端的连接.
我怎样才能做到这一点?
到目前为止我所做的是:
public static TcpListener Listener; public static int Port = 8080; static void Main(string[] args) { IniFile FPth = new IniFile(@"D:\ServerInfo.ini"); ServerPort = int.Parse(FPth.IniReadValue("ConnectionINFO","ServerPort")); Listener = new TcpListener(IPAddress.Any,Port); Listener.Start(); Thread NewThread = new Thread(new ThreadStart(ChangingINFO)); ChangingINFO(); Console.WriteLine("Server is ONLINE."); } static ChangingINFO() { while (true) { Socket Sockt = Listener.AcceptSocket(); try { if (Sockt.Connected) { //Here I should get the @R_393_4045@ion from the client on submit. //But I don't kNow how } }
但我不知道如何制作html页面,我将信息发送到服务器并使用它们.
解决方法
在原始套接字上实现自己的HTTP协议将是一项相当大的任务.您可以使用Mono XSP嵌入可以将ASP.NET页面提供给应用程序的Web服务器,或者您可以使用HttpListener:
http://msdn.microsoft.com/en-us/library/system.net.httplistener(v=vs.100).aspx
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。