Network Programming in Java-2

Source: Internet
Author: User

Socket Programming: (General network programming)

<1> two JAVA applications can exchange data through a two-way network communication connection, a section of this bidirectional link is called a Socket.

<2> sockets are commonly used to implement client-server connections.

The two class sockets and serversocket (blocking) defined in the <3> java.net package are used to implement both the client and Server side of the two-way connection.

<4> when establishing a connection, the required addressing information is the IP address and port number of the remote computer (port number, 2 bytes, 65,536 ports, one application may have multiple port numbers)

TCP port, UDP port separate, technically speaking, only TCP want $ Server, Client.

Each has 65,536 ports, the port number is used to distinguish between different applications on the same machine, a person occupies a certain port number, others can not be accounted for.

Write your own program, account for 1024 after the port number, 1024 before the occupation, the system may be ready to requisition.

TCP and UDP are not the same.

<5> Default Web page HTTP port is 80 port;

SMTP (mail send): 25 port

POP3 (Incoming mail): 110 port

<6> Write TCPServer, TCPclient program, first start the Server, and then start the Client, while writing programs, developed together.

Network Programming in Java-2

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.