Summary of andriod socket development issues
Personal information: a senior majoring in software project of yanda University;
My blog: Google searches for "cqs_2012;
My hobbies: I love data structures and algorithms and hope to make my own contribution to algorithm work in the future;
Programming Language: Java;
Programming Environment: Windows 7 Professional Edition x64;
Programming tools: JDK, Eclipse, AVD;
Drawing tools: Office 2010 PowerPoint;
Hardware information: 7g-3 Notebook;
Zhenyan
Make progress only when there is a problem, and the problem makes you more logical. A problem encountered at work is a problem left over from life ---- Chen qingsong
Problem (if you have the following problem in andriod socket, check it)
1. Assume that your andriod program cannot connect to the network. Add the following statement to the list file of andriodproject.
<Manifest xmlns: Android = "http://schemas.android.com/apk/res/android"
Package = "com. ICSS. myappnotebook"
Android: versioncode = "1"
Android: versionname = "1.0" type = "codeph" text = "/codeph">
<Uses-Permission Android: Name = "android. Permission. Internet"> </uses-Permission>
</Manifest>
2. Assume that your socket program can be connected to the serversocket of the computer in the virtual machine, but not on the mobile phone,
Pay attention to the following two points:
1). Write your clientsocket in a new thread. Do not write it in the current activity;
2) Add the following code to the oncreate () function in your current activity:
Strictmode. setthreadpolicy (New strictmode. threadpolicy. Builder (). detectdiskreads (). detectdiskwrites (). detectnetwork (). penaltylog (). Build ());
Strictmode. setvmpolicy (New strictmode. vmpolicy. Builder (). detectleakedsqlliteobjects (). penaltylog (). penaltydeath (). Build ());
Storage location, which is placed at the end of the function.
3. Assume that your socket program can connect to the serversocket of the computer in the Virtual Machine and send data to the server, but cannot receive data from the server. What should I do?
Let's stare at the close of all your socket data streams and wish you good luck.
4. If your program still has problems, please leave a message below to help you solve the problem.
Summary of andriod socket development issues