Let's take a look at the TCP client side and the service side of the chat program to the wording
is a client side (Socket) and server (ServerSocket) side of the link between. My understanding is that a server can link multiple customer service side.
There is an input stream outputstream on the customer service side. Used to send data
There is an output stream on the server side. InputStream. Used to accept data.
I feel that I can understand the rest of the writing a few more times.
Customer-side socket
Package Text;import Java.io.outputstream;import Java.net.inetaddress;import java.net.socket;public class Soc{ public static void Main (string[] args) throws Exception { //Send end link socket s = new socket ( Inetaddress.getbyname ("192.168.1.100"), 10010); Give an input stream outputstream out = S.getoutputstream (); Write to the output stream. Out.write ("I wonder if you're an idiot?"). GetBytes ()); S.close (); }}
Here is the wording of my server:
Package Text;import Java.io.inputstream;import Java.net.serversocket;import java.net.socket;public class socSev{ //tcp Server //1. Set up a service-side socket service. And listen for the appropriate port //2. Then get to the customer service end of the object. Accept (); 4. Then read the corresponding data public static void Main (string[] args) throws Exception { //create server-side socket ServerSocket SS = New ServerSocket (10010); Socket s = ss.accept ();//Get the socket of the customer service //Get the IP address of the client terminal String IP = s.getinetaddress (). gethostaddress (); System.out.println (ip+ "link ........."); Gets the input byte stream inputstream input = S.getinputstream (); byte[] buf = new byte[1024]; Read Data int i=input.read (BUF); System.out.println (New String (Buf,0,i)); Close connection s.close (); Ss.close (); }}
DNS (domain Name System, domainname),
A distributed database that maps the domain name and IP address on the Internet makes it easier for users to access the Internet without remembering the number of IP strings that can be read directly by the machine. The process of obtaining the IP address of the host name through the hostname is called Domain name resolution (or hostname resolution). The DNS protocol runs on top of the UDP protocol, using the port number 53. RFC 2181 has a canonical description of DNS in RFC 2136, a description of dynamic updates to DNS, and RFC 2308 describes the reverse caching of DNS queries.
Description: When you visit through the website. is to access your corresponding host through the domain name, then the resolution of your domain will be directed to your host.
Analysis of the record in detail: Today in the domain name resolution found to resolve the domain name of their own stumbled, so do an explanation.
A record: Point the domain name to a IPV4 address (for example: 10.10.10.10), you need to add a record CNAME record: If you point to a domain name, to achieve the same access to the domain name, you need to increase the CNAME record MX record: the establishment of e-mail service, will point to the mail server address, need Set MX record NS record: Domain name resolution server record, if you want to specify a subdomain name server to resolve, you need to set NS record TXT record: can be filled (can be empty), Typically used as an SPF record (anti-spam) to use AAAA records: to point the hostname (or domain name) to a IPV6 address (for example: FF03:0:0:0:0:0:0:C1), you need to add AAAA record SRV records: Records which computer provided which service. The format is: the name of the service. Type of protocol (ex: _EXAMPLE-SERVER._TCP) Explicit URL: Point the domain name to an HTTP (s) protocol address, and when you access the domain name, Automatically jumps to the destination address (for example: After www.net.cn dominance is forwarded to www.hichina.com, when you access www.net.cn, the address bar displays the address: www.hichina.com). Recessive URL: Similar to a dominant URL, but implicit forwarding hides the actual destination address (for example, when the www.net.cn implicitly forwards to www.hichina.com, the address bar displays the address as: www.net.cn) when the www.net.cn is accessed.
Black Horse programmer-network programming