Socket entry example of Java network programming basic tutorial

When we want to use TCP / IP in Java to connect to the server through the network, we need to create Java net. Socket object and connect to the server. If you want to use Java NiO, you can also create a socketchannel object in Java NiO.

Create socket

The following example code is connected to an IP address of 78.64 Port 80 on the 84.171 server is our web server (www.jb51. Net), and port 80 is the web service port.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>