套接字认证 [英] Authentication with Socket
本文介绍了套接字认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们,
我想连接路由器"192.168.1.1"上的套接字,然后要求输入密码"admin" ...
如何将验证密码"admin"发送到路由器以发送请求?
Hi friends,
I want to connect with the socket on my router "192.168.1.1" then it asks for a password is "admin"...
how can i send the authenticating password "admin" to my router to send my requests?
tcpclient.Connect("192.168.1.1", 23);
NetworkStream ns = tcpclient.GetStream();
byte[] msg = Encoding.ASCII.GetBytes("show all");
ns.Write(msg, 0, msg.Length);
ns.Flush();
byte[] inStream = new byte[10025];
ns.Read(inStream, 0, (int)tcpclient.ReceiveBufferSize);
string returndata = System.Text.Encoding.ASCII.GetString(inStream);
Console.WriteLine("Data from Server : " + returndata);
这是连接到我要强化的路由器的代码...
谢谢codeproje
This is the code to connect to the router i want to autentificate...
thank you codeproje
推荐答案
如果要使用路由器的Web界面进行连接,则可以使用WebClient
类.请查看链接以获取更多信息:
http://msdn.microsoft.com/en-us/library/system.net.webclient%28VS.80%29.aspx [
If you want to connect using the web interface of your router then you could use theWebClient
class. Check out the link for more info:
http://msdn.microsoft.com/en-us/library/system.net.webclient%28VS.80%29.aspx[^]
Good luck!
这篇关于套接字认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文