Java Network Programming-(1) Introducing network programming

Source: Internet
Author: User

Network programming is now a very common programming technology, network programming is nothing more than two or more devices (usually the computer) between the communication between each other, data transmission. The essence of the network programming is actually the communication between the program and the program, passing the data to each other. In network communication, the first unsolicited communication request becomes the client, thefirst communication waiting for the connection is called the server side (server), in the process of network communication, Client End and Server There is no essential difference in the end.

So how do you find the server through the client to communicate with the network? The answer is throughIPTo find the server, we all know that the server is running a number of programs, that is, multiple processes, it is necessary to use the port number to determine the only one of the running program on a server, in the form of "Ip:port"So when you enter in the browser (client)Ip:port, the request is sent, the server responds and returns the result to the browser, and you can see the content. However,Ip:portIt's hard to remember, it's on the showDomain nameThe concept, such as: when you enterwww.baidu.com, you will jump to the server Baidu, you will see the homepage of Baidu, but actually still throughIp:portto access the server, you can enter103.235.46.39:80Look, I'll enter it with you.www.baidu.comthe same result. So, how to parse a domain name into the specifiedIp:port, then there will be aDNS Server (domain name resolution Server) , which is used to dynamically tell the domain name to a running program on the specified server to enable the interconnection between the client and the server.

In the process of network communication, the most common communication model is the "request - corresponding" model, that is, the client sends a request, the server side receives the request processing after the response to the client process. So now the problem, how the client sends a request, the server successfully received processing, response to the client, then, the network protocol is required. Protocol, as the name implies is the contract between the client and the server, in accordance with the agreed request data format and response data format to achieve network communication, it is obvious that such a contract should follow the "simple, convenient, practical" principle, so as to ensure the client and server-side communication success rate. In fact, the protocol can be written at will, as long as the written protocol format can generate a unique encoding, according to the code can only parse the contents of the sending data can be. Because of the different protocol formats between the various network programs, client programs are specialized and special structures.

In the actual network programming, basically is sends (send) and receives (accept) two operation . Most programming languages that support network programming techniques have specific APIsthat encapsulate the interfaces of the two operations, which can be called directly when programming. In fact, the most difficult network programming is the design of the network protocol, which is the most core content of network programming, interested in the next RFC can be studied the principle.

Java Network Programming-(1) Introducing network programming

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.