IP targeting computer
lnetAddress
Port Positioning Software
1. distinguish software
2. two bytes of the TCP the UDP 0-65535
3. does not conflict with a protocol port
4. The port number the better
understand the recognized port portion 80 HTTP protocol 8080 Tomcat server 443 HTTPS protocol 1521Oracle 3306 MYSQL
lnetScokerAddress
1. Constructor
new lnetScokerAddress(域名|地址,端口)
2. Methods
getAddress()//获取地址
getport()//获取端口
URL positioning software in every resource
URL: Uniform Resource Locator (Universal Resource Locator), one of the three cornerstones of the Internet (HTML, HTTP)
https://www.baidu.com:443/index.html?uname=shsxt&age=18#a
1. Protocol: HTTPS
2. domain, the computer: www.baidu.com
3. port (default 80): 443
4. requested resource index.html uname = shsxt & age = 18 ?
Parameters: uname = shsxt & age = 18
anchors: a
package 网络编程开篇;
import java.net.MalformedURLException;
import java.net.URL;
public class urltest {
public static void main(String[] args) throws MalformedURLException {
URL url =new URL("https://www.baidu.com:443/index.html?uname=shsxt&age=18#a");
System.out.println("协议"+url.getProtocol());
System.out.println("域名ip"+url.getHost());
System.out.println("端口"+url.getPort());
System.out.println("请求资源"+url.getPath());
System.out.println("请求资源"+url.getFile());
System.out.println("参数"+url.getQuery());
System.out.println("锚点"+url.getRef());
}
}