Socket-based network communication in Android

Source: Internet
Author: User

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

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.