Method of implementing TCP client by Android programming
This paper describes the method of implementing TCP client by Android programming. Share with you for your reference, as follows:
Because the project needs to implement a TCP client; Many examples on the Internet are basically completed by blocking;
My implementation example: it is implemented by activity and sever. A thread is created in sever to listen and accept data. Receive data and send it to activity through broadcast;
I didn't implement the server. You can download TCP socket debugging tool V2.2; Create 9005 ports; Client: the IP accessed is 10.0.2.2
AnetTest.java:
Receivemessage.java refers to network resources and can be modified;
AndroidManifest.xml
For more Android related content, readers who are interested can view the topics on this site: summary of Android communication methods, summary of Android debugging skills and solutions to common problems, introduction and advanced tutorial of Android development, summary of Android multimedia operation skills (audio, video, recording, etc.), summary of the usage of Android basic components Summary of Android view skills, summary of Android layout skills and summary of Android control usage
I hope this article will help you in Android programming.