java foundation (network programming --- IP, port, URL)

IP addresses

Used to identify a communication address of the network entity. Communication entity may be a computer, router or the like. 
 IP address classification
  IPV4: 32-bit address in dotted decimal notation, such as 192.168.0.1
  IPV6: 128 bits (16 bytes) is written as eight 16-bit unsigned integers, each integer expressed by four hexadecimal digits, numbers by colons (:)
    Separately, such as: 3ffe: 3201: 1401: 1280: c8ff: fe4d: db39: 1984
 Special IP
   Local address 127.0.0.1
  192.168.0.0--192.168.255.255 private address, is a non-registered address, used exclusively for the internal organization.
 

 InetAddress:

  Multiple static method
  1, getLocalHost: this machine
  2, getByName: according to domain DNS | IP addresses -> IP

   two members of method
  1, getHostAddress: return address
  2, getHostName: return the computer name

port

  To distinguish between different programs on your computer, it is necessary to use the port.

  It indicates the port is a 16-bit binary integer, 2 bytes, corresponding to the decimal 0-65535.
   Oracle, MySQL, Tomcat, QQ, msn, Thunder, 360 and other network program has its own port
  
  For example, 0-1023 recognized port 80 port assigned to the WWW, 21 port assigned to the FTP
 registered ports 1024-49151 assigned to the user process or application
 dynamic / private ports 49152--65535
 
   cmd window view ports and processes:
  See all ports: netstat -ano
  Check the specified port: netstat -aon | findstr "808"
  Check the specified process: tasklist | findstr "808"
  View specific program: Use Task Manager to view PID
 
  InetSocketAddress
  Comprising a port for a socket communication
 

URL  

  URN: Universal Resource Name Uniform Resource Name to identify resources through specific namespace a unique name or ID.
  
  On the www, each has a unified information resource and a unique address, or Uniform Resource Locator Uniform Resource Locator.
  Such as: http: //www.google.com: 80 / index.html, consists of four parts:
  • http protocol
  • storage resource host domain name www.google.com
  • Port 80
  • Resource file name index.html
 
   API

 

 

Guess you like

Origin www.cnblogs.com/skyline1/p/11228322.html