Socket-based network communication in Android
The socket is also called a socket, and the application usually makes a request to the network through a "socket" or answers a network request.
In Java, the Scoket and Serverscoket class libraries are located in the java.net package, The Serverscoket is used on the server side andScoket is used when establishing a network connection . When the connection succeeds , both ends of the application produce a Scoket instance that completes the required session.
for a network connection, sockets are equal, and there is no difference, not because of the different levels on the server or client side. Whether it's Scoket or serverscoket, their work is done through the Scoket class and its subclasses.
The process of establishing a scoket connection
1 Server Monitoring
2 Client makes a request
3 Establishing the connection
4 Communication
Features of Scoket
1Scoket based on TCP link, data transmission is guaranteed '
2Scoket for establishing long-time links
3Scoket programming is typically applied to instant messaging
This article is from "Android" blog, please be sure to keep this source http://hw168.blog.51cto.com/10425348/1662552
Socket-based network communication in Android