C # implement automatic router disconnection and IP address replacement
Currently, the routers we use are all managed on the WEB interface, and there are very few routers that actually support TELNET (port 23. for this. we can use socket to operate port 80 of the router. send a command to the router to disconnect the router. at the same time, set the router to automatic connection. the automatic IP address replacement function can be implemented. vro login authentication adopts BASE64 encrypted Login Name: Password format. for example, admin: the password string obtained by admin is YWRtaW46YWRtaW4 = Convert can be easily implemented in c. toBase64String (Encoding. default. getBytes ("admin: admin") we use the http get Operation GET/userRpm/StatusRpm.htm? Disconnect = % B6 % CF + % CF % DF & wan = 1 HTTP/1.1 Host: 192.168.1.1Authorization: basic YWRtaW46YWRtaW4 = can be used to call the router disconnection operation. Can you also use GET/userRpm/SysRebootRpm.htm? Reboot = % D6 % D8 % C6 % F4 % C2 % B7 % D3 % C9 % C6 % F7 HTTP/1.1 Host: 192.168.1.1Authorization: basic YWRtaW46YWRtaW4 = is used to restart the vro. The above addresses are in TPLINK WR740N and TPLINK R402M. The obtained code snippets can be obtained through the MX3 network monitoring function of vrouters of other brands: <FORM action = "StatusRpm.htm" enctype = "multipart/form-data" method = "get"> use the GET method <SCRIPT language = "JavaScript"> var wlan_wds = 1; var wlan_rate = 0; <! -- Function doRefresh () {location. href = "/userRpm/StatusRpm.htm"; return true;} function doConnect (n) {var s = "& wan =" + n; location. href = "/userRpm/StatusRpm.htm? Connect = Connect "+ s; return true;} function doDisConnect (n) {var s =" & wan = "+ n; location. href ="/userRpm/StatusRpm.htm? Disconnect = disconnected "+ s; return true;} the disconnected call is"/userRpm/StatusRpm.htm? Disconnect = disconnected "do not use this program to perform operations in violation of Internet regulations. For more information, see c # application.