[Android] socket applications on mobile phones, android
1. Mobile Assistant
1.1 USB Link
You can read the PID and VID of the mobile phone, identify the unique device, and install the corresponding driver for the mobile phone.
Socket Communication on fixed ports
1.2 WIFI connection
The pc sends UDP data packets in the entire network segment of the computer. After the mobile phone connects to wifi, it can listen to this port, receive the data packets, and try to establish a connection with the pc.
Bluetooth 1.3
Pairing through ipvthsocket
2. Purpose
2.1 large data volume, high real-time transmission requirements
Chat tools, stock trading
Socket persistent connection, heartbeat packet, send heartbeat packet to the server every 30 seconds
2.2 small data size
Message push and Precision Marketing
Send a UDP packet every 10 minutes. The packet must contain authentication information (application + User ID)
Import java. util. timer; import java. util. timerTask; public class TimerTest {/*** @ param args */public static void main (String [] args) {Timer timer = new Timer (); timer. schedule (new TimerTask () {@ Override public void run () {System. out. println ("1") ;}},); // executed once every second after 1 second }}