Android 与电脑的Socket通信为什么不能c udp通信接收数据据

android在wifi下手机与电脑的socket通信
Android平台开发
开发语言:Java
实例大小:5.93M
下载次数:
浏览次数:
发布时间:
实例类别:Android平台开发
发 布 人:
所需积分:2
&相关标签:
同类人气实例
实例下载地址
android在wifi下手机与电脑的socket通信
不能下载?内容有错? 点击这里报错
好例子网口号:伸出你的我的手 & 分享!
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
Copyright &
好例子网(www.haolizi.net).All Rights Reserved备案编号:冀ICP备号 石公备号(10)android客户端和服务器进行socket通信无法获得数据 - ITeye问答
本人在做一个android客户端和服务器进行socket通信的时候,遇到一个问题。我原先的意图是:
1. 客户端发送数据到服务器端
2. 服务器端获得数据,之后再把此数据返回给客户端
3. 客户端取得数据并显示在TextView里
现在我遇到的问题在第3阶段,通过调试发现客户端无法取得数据,在这一步的时候
BufferedReader in= new BufferedReader(new InputStreamReader(server.getInputStream()));
会报IOException错误。请android或者java牛人们帮忙看下!
感激不尽!
服务器端代码:
public class RSAServer {
public static void main(String[] args) {
ServerSocket server = new ServerSocket(8888);
while (true) {
System.out.println("server starting...");
Socket client = server.accept();
System.out.println("server ready...");
InputStream in = client.getInputStream();
BufferedReader inBuffer=
new BufferedReader(new InputStreamReader(in));
StringBuilder source = new StringBuilder();
while((ch = inBuffer.readLine())!= null){
source.append(ch);
System.out.println(source.toString());
in.close();
OutputStream out = client.getOutputStream();
out.write("test".getBytes());
out.flush();
out.close();
client.close();
} catch (Exception e) {
System.out.println("服务器端异常!");
客户端代码:
public class MainActivity extends Activity implements OnClickListener {
private TextView android_Id_View =
private String android_Id =
private Button sendBtn =
private TextView decode_View =
private String localHost = "192.168.10.79"; //我本机的地址
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
android_Id = getANDROID_ID();
android_Id_View = (TextView) findViewById(R.id.android_ID);
android_Id_View.setText(android_Id);
sendBtn = (Button) findViewById(R.id.sendBtn);
sendBtn.setOnClickListener(this);
decode_View = (TextView) findViewById(R.id.decode);
public String getANDROID_ID() {
String android_Id = Settings.Secure.getString(getContentResolver(),
Settings.Secure.ANDROID_ID);
return android_Id;
public void onClick(View v) {
Socket server = new Socket(localHost, 8888);
OutputStream out = server.getOutputStream();
out.write(android_Id.getBytes());
out.flush();
[color=red]
out.close(); //必须关闭,不然request time out[/color]
BufferedReader in= new BufferedReader(new InputStreamReader(server.getInputStream()));
StringBuilder encryptKey = new StringBuilder();
while((ch = in.readLine()) != null){
encryptKey.append(ch);
String key = encryptKey.toString();
System.out.println(key);
decode_View.setText(key);
server.close();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
System.out.println("UnknownHostException!");
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("IOException!");
把客户端和服务器端中“关于流的关闭代码全部注释掉”。。试下吧。祝你好运。。
已解决问题
未解决问题android--socket 在局域网下通过WIFI手机和电脑用 通信,可接收可发送。 Win -NDIS 网络编程 254万源代码下载-
&文件名称: android--socket& & [
& & & & &&]
&&所属分类:
&&开发工具: JavaScript
&&文件大小: 6240 KB
&&上传时间:
&&下载次数: 19
&&提 供 者:
&详细说明:在局域网下通过WIFI手机和电脑用SOCKET通信,可接收可发送。-In the local area net through WIFI using SOCKET communication, cell phones and computers can receive can send.
文件列表(点击判断是否您需要的文件,如果是垃圾请在下面评价投诉):
&&android在wifi下手机与电脑的socket通信&&.....................................\android在wifi下手机与电脑的socket通信.doc&&.....................................\workspace&&.....................................\.........\ControlPC&&.....................................\.........\.........\.classpath&&.....................................\.........\.........\.project&&.....................................\.........\.........\.settings&&.....................................\.........\.........\.........\org.eclipse.jdt.core.prefs&&.....................................\.........\.........\AndroidManifest.xml&&.....................................\.........\.........\assets&&.....................................\.........\.........\bin&&.....................................\.........\.........\...\AndroidManifest.xml&&.....................................\.........\.........\...\classes&&.....................................\.........\.........\...\classes.dex&&.....................................\.........\.........\...\.......\gjz&&.....................................\.........\.........\...\.......\...\ControlPC&&.....................................\.........\.........\...\.......\...\.........\BuildConfig.class&&.....................................\.........\.........\...\.......\...\.........\ControlPCActivity$1.class&&.....................................\.........\.........\...\.......\...\.........\ControlPCActivity$2.class&&.....................................\.........\.........\...\.......\...\.........\ControlPCActivity$3.class&&.....................................\.........\.........\...\.......\...\.........\ControlPCActivity$4.class&&.....................................\.........\.........\...\.......\...\.........\ControlPCActivity$5.class&&.....................................\.........\.........\...\.......\...\.........\ControlPCActivity.class&&.....................................\.........\.........\...\.......\...\.........\R$attr.class&&.....................................\.........\.........\...\.......\...\.........\R$drawable.class&&.....................................\.........\.........\...\.......\...\.........\R$id.class&&.....................................\.........\.........\...\.......\...\.........\R$layout.class&&.....................................\.........\.........\...\.......\...\.........\R$string.class&&.....................................\.........\.........\...\.......\...\.........\R.class&&.....................................\.........\.........\...\ControlPC.apk&&.....................................\.........\.........\...\dexedLibs&&.....................................\.........\.........\...\.........\annotations-e02ceb0f3c74a844bc729a.jar&&.....................................\.........\.........\...\.........\annotations-af5a96e7b73e9e1309778.jar&&.....................................\.........\.........\...\jarlist.cache&&.....................................\.........\.........\...\res&&.....................................\.........\.........\...\resources.ap_&&.....................................\.........\.........\...\...\crunch&&.....................................\.........\.........\...\...\......\drawable-hdpi&&.....................................\.........\.........\...\...\......\.............\bg_chat.png&&.....................................\.........\.........\...\...\......\.............\ic_launcher.png&&.....................................\.........\.........\...\...\......\drawable-ldpi&&.....................................\.........\.........\...\...\......\.............\ic_launcher.png&&.....................................\.........\.........\...\...\......\drawable-mdpi&&.....................................\.........\.........\...\...\......\.............\ic_launcher.png&&.....................................\.........\.........\...\...\drawable-hdpi&&.....................................\.........\.........\...\...\.............\bg_chat.png&&.....................................\.........\.........\...\...\.............\ic_launcher.png&&.....................................\.........\.........\...\...\drawable-ldpi&&.....................................\.........\.........\...\...\.............\ic_launcher.png&&.....................................\.........\.........\...\...\drawable-mdpi&&.....................................\.........\.........\...\...\.............\ic_launcher.png&&.....................................\.........\.........\gen&&.....................................\.........\.........\...\gjz&&.....................................\.........\.........\...\...\ControlPC&&.....................................\.........\.........\...\...\.........\BuildConfig.java&&.....................................\.........\.........\...\...\.........\R.java&&.....................................\.........\.........\proguard.cfg&&.....................................\.........\.........\project.properties&&.....................................\.........\.........\res&&.....................................\.........\.........\...\drawable-hdpi&&.....................................\.........\.........\...\.............\bg_chat.png&&.....................................\.........\.........\...\.............\ic_launcher.png&&.....................................\.........\.........\...\drawable-ldpi&&.....................................\.........\.........\...\.............\ic_launcher.png&&.....................................\.........\.........\...\drawable-mdpi&&.....................................\.........\.........\...\.............\ic_launcher.png&&.....................................\.........\.........\...\drawable-xhdpi&&.....................................\.........\.........\...\layout&&.....................................\.........\.........\...\......\main.xml&&.....................................\.........\.........\...\......\mouse_layout.xml&&.....................................\.........\.........\...\values&&.....................................\.........\.........\...\......\strings.xml&&.....................................\.........\.........\src&&.....................................\.........\.........\...\gjz&&.....................................\.........\.........\...\...\ControlPC&&.....................................\.........\.........\...\...\.........\ControlPCActivity.java&&.....................................\.........\Keyexe&&.....................................\.........\......\Debug&&.....................................\.........\......\.....\KeyboardHook.dll&&.....................................\.........\......\.....\KeyboardHook.lib&&.....................................\.........\......\.....\Keyexe.bsc&&.....................................\.........\......\.....\Keyexe.exe&&.....................................\.........\......\.....\Keyexe.ilk&&.....................................\.........\......\.....\Keyexe.obj&&.....................................\.........\......\.....\Keyexe.pch&&.....................................\.........\......\.....\Keyexe.pdb&&.....................................\.........\......\.....\Keyexe.res&&.....................................\.........\......\.....\Keyexe.sbr&&.....................................\.........\......\.....\KeyexeDlg.obj&&.....................................\.........\......\.....\KeyexeDlg.sbr&&.....................................\.........\......\.....\StdAfx.obj&&.....................................\.........\......\.....\StdAfx.sbr&&.....................................\.........\......\.....\vc60.idb&&.....................................\.........\......\.....\vc60.pdb&&.....................................\.........\......\icon1.ico&&.....................................\.........\......\key.txt&&.....................................\.........\......\KeyboardHook.dll&&.....................................\.........\......\KeyboardHook.lib&&.....................................\.........\......\keydll3.H&&.....................................\.........\......\Keyexe.aps
&[]:纯粹是垃圾&[]:和说明完全不符
&近期下载过的用户:
&相关搜索:
&输入关键字,在本站254万海量源码库中尽情搜索:
&[] - android开机启动,清除缓存,关闭程序
&[] - android example using button, edit text, text view, analog clock, keyboard.
It is in italian !
&[] - 基于安卓手机控制或者PC上位机控制智能小车的C程序
&[] - android在wifi下手机与电脑的socket通信,代码很有实用价值
&[] - android探索周围wifi信号强度,并且记录在文件中,可用于构建wifi定位数据库
&[] - android 基础学习,常用的widget、动画、数据存储、http通信等
&[] - 用手机进行通信,能用wifi进行数据采集,用android的socket编程
&[] - android移动端局域网内通过UDP实现即时通信聊天。
&[] - PC客户端与android服务端的socket同步通信
&[] - 可以通过智能手机与电脑通信,查询数据库,并且进一步通过串口与单片机通信(zigbee),完善后可用于智能家居下次自动登录
现在的位置:
& 综合 & 正文
PC客户端与Android服务端的Socket同步通信
1.一个android端的service后台运行的,作为socket的服务器端;用于接收Pc client端发来的命令,来处理数据后,把结果发给PC client
2.PC端程序,作为socket的客户端,用于给android手机端发操作命令
难点分析:
1.手机一定要有adb模式,即插上USB线时马上提示的对话框选adb。好多对手机的操作都可以用adb直接作。
不过,我发现LG GW880就没有,要去下载个
2.android默认手机端的IP为“127.0.0.1”
3.要想联通PC与android手机的sokcet,一定要用adb forward 来作下端口转发才能连上socket.
Runtime.getRuntime().exec("adb forward tcp:12580 tcp:10086");
Thread.sleep(3000);
4.android端的service程序Install到手机上容易,但是还要有方法来从PC的client端来启动手机上的service ,这个办法可以通过PC端adb命令来发一个Broastcast ,手机端再写个接收BroastcastReceive来接收这个Broastcast,在这个BroastcastReceive来启动service
pc端命令:
Runtime.getRuntime().exec(
"adb shell am broadcast -a NotifyServiceStart");
android端的:ServiceBroadcastReceiver.java
package com.otheri.
import android.content.BroadcastR
import android.content.C
import android.content.I
import android.util.L
public class ServiceBroadcastReceiver extends BroadcastReceiver {
private static String START_ACTION = "NotifyServiceStart";
private static String STOP_ACTION = "NotifyServiceStop";
public void onReceive(Context context, Intent intent) {
Log.d(androidService.TAG, Thread.currentThread().getName() + "----&"
+ "ServiceBroadcastReceiver onReceive");
String action = intent.getAction();
if (START_ACTION.equalsIgnoreCase(action)) {
context.startService(new Intent(context, androidService.class));
Log.d(androidService.TAG, Thread.currentThread().getName() + "----&"
+ "ServiceBroadcastReceiver onReceive start end");
} else if (STOP_ACTION.equalsIgnoreCase(action)) {
context.stopService(new Intent(context, androidService.class));
Log.d(androidService.TAG, Thread.currentThread().getName() + "----&"
+ "ServiceBroadcastReceiver onReceive stop end");
5.由于是USB连接,所以socket就可以设计为一但连接就一直联通,即在new socket和开完out,in流后,就用个while(true){}来循环PC端和android端的读和写
android的代码:
public void run() {
Log.d(androidService.TAG, Thread.currentThread().getName() + "----&"
+ "a client has connected to server!");
BufferedOutputS
BufferedInputS
String currCMD = "";
out = new BufferedOutputStream(client.getOutputStream());
in = new BufferedInputStream(client.getInputStream());
androidService.ioThreadFlag = true;
while (androidService.ioThreadFlag) {
if (!client.isConnected()) {
Log.v(androidService.TAG, Thread.currentThread().getName()
+ "----&" + "will read......");
currCMD = readCMDFromSocket(in);
Log.v(androidService.TAG, Thread.currentThread().getName()
+ "----&" + "**currCMD ==== " + currCMD);
if (currCMD.equals("1")) {
out.write("OK".getBytes());
out.flush();
} else if (currCMD.equals("2")) {
out.write("OK".getBytes());
out.flush();
} else if (currCMD.equals("3")) {
out.write("OK".getBytes());
out.flush();
} else if (currCMD.equals("4")) {
out.write("service receive OK".getBytes());
out.flush();
} catch (IOException e) {
e.printStackTrace();
byte[] filelength = new byte[4];
byte[] fileformat = new byte[4];
byte[] filebytes = null;
filebytes = receiveFileFromSocket(in, out, filelength,
fileformat);
File file = FileHelper.newFile("R0013340.JPG");
FileHelper.writeFile(file, filebytes, 0,
filebytes.length);
} catch (IOException e) {
e.printStackTrace();
} else if (currCMD.equals("exit")) {
} catch (Exception e) {
Log.e(androidService.TAG, Thread.currentThread().getName()
+ "----&" + "read write error111111");
out.close();
in.close();
} catch (Exception e) {
Log.e(androidService.TAG, Thread.currentThread().getName()
+ "----&" + "read write error222222");
e.printStackTrace();
} finally {
if (client != null) {
Log.v(androidService.TAG, Thread.currentThread().getName()
+ "----&" + "client.close()");
client.close();
} catch (IOException e) {
Log.e(androidService.TAG, Thread.currentThread().getName()
+ "----&" + "read write error333333");
e.printStackTrace();
6.如果是在PC端和android端的读写操作来while(true){}循环,这样socket流的结尾不好判断,不能用“-1”来判断,因为“-1”是只有在socket关闭时才作为判断结尾。
7.socket在out.write(bytes);时,要是数据太大时,超过socket的缓存,socket自动分包发送,所以对方就一定要用循环来多次读。最好的办法就是服务器和客户端协议好,比如发文件时,先写过来一个要发送的文件的大小,然后再发送文件;对方用这个大小,来循环读取数据。
android端接收数据的代码:
public static byte[] receiveFileFromSocket(InputStream in,
OutputStream out, byte[] filelength, byte[] fileformat) {
byte[] filebytes = null;
int filelen = MyUtil.bytesToInt(filelength);
String strtmp = "read file length ok:" +
out.write(strtmp.getBytes("utf-8"));
out.flush();
filebytes = new byte[filelen];
int pos = 0;
int rcvLen = 0;
while ((rcvLen = in.read(filebytes, pos, filelen - pos)) & 0) {
pos += rcvL
Log.v(androidService.TAG, Thread.currentThread().getName()
+ "----&" + "read file OK:file size=" + filebytes.length);
out.write("read file ok".getBytes("utf-8"));
out.flush();
} catch (Exception e) {
Log.v(androidService.TAG, Thread.currentThread().getName()
+ "----&" + "receiveFileFromSocket error");
e.printStackTrace();
8.socket的最重要的机制就是读写采用的是阻塞的方式,如果客户端作为命令发起者,服务器端作为接收者的话,只有当客户端client用out.writer()写到输出流里后,即流中有数据service的read才会执行,不然就会一直停在read()那里等数据。
9.还要让服务器端可以同时连接多个client,即服务器端用new thread()来作数据读取操作。
客户端(pc端):
testPcClient.java
import java.io.BufferedInputS
import java.io.BufferedOutputS
import java.io.BufferedR
import java.io.ByteArrayOutputS
import java.io.IOE
import java.io.InputS
import java.io.InputStreamR
import java.net.InetA
import java.net.S
import java.net.UnknownHostE
public class testPcClient {
public static void main(String[] args) throws InterruptedException {
Runtime.getRuntime().exec(
"adb shell am broadcast -a NotifyServiceStop");
Thread.sleep(3000);
Runtime.getRuntime().exec("adb forward tcp:12580 tcp:10086");
Thread.sleep(3000);
Runtime.getRuntime().exec(
"adb shell am broadcast -a NotifyServiceStart");
Thread.sleep(3000);
} catch (IOException e3) {
e3.printStackTrace();
Socket socket = null;
InetAddress serverAddr = null;
serverAddr = InetAddress.getByName("127.0.0.1");
System.out.println("TCP 1111" + "C: Connecting...");
socket = new Socket(serverAddr, 12580);
String str = "hi,wufenglong";
System.out.println("TCP 221122" + "C:RECEIVE");
BufferedOutputStream out = new BufferedOutputStream(socket
.getOutputStream());
BufferedInputStream in = new BufferedInputStream(socket
.getInputStream());
BufferedReader br = new BufferedReader(new InputStreamReader(
System.in));
boolean flag = true;
while (flag) {
System.out.print("请输入1~6的数字,退出输入exit:");
String strWord = br.readLine();
if (strWord.equals("1")) {
out.write("1".getBytes());
out.flush();
System.out.println("1 finish sending the data");
String strFormsocket = readFromSocket(in);
System.out.println("the data sent by server is:/r/n"
+ strFormsocket);
System.out
.println("=============================================");
} else if (strWord.equals("2")) {
out.write("2".getBytes());
out.flush();
System.out.println("2 finish sending the data");
String strFormsocket = readFromSocket(in);
System.out.println("the data sent by server is:/r/n"
+ strFormsocket);
System.out
.println("=============================================");
} else if (strWord.equals("3")) {
out.write("3".getBytes());
out.flush();
System.out.println("3 finish sending the data");
String strFormsocket = readFromSocket(in);
System.out.println("the data sent by server is:/r/n"
+ strFormsocket);
System.out
.println("=============================================");
} else if (strWord.equals("4")) {
out.write("4".getBytes());
out.flush();
System.out.println("send file finish sending the CMD:");
String strFormsocket = readFromSocket(in);
System.out
.println("service ready receice data:UPDATE_CONTACTS:"
+ strFormsocket);
byte[] filebytes = FileHelper.readFile("R0013340.JPG");
System.out.println("file size=" + filebytes.length);
byte[] filelength = new byte[4];
filelength = tools.intToByte(filebytes.length);
byte[] fileformat = null;
fileformat = ".apk".getBytes();
System.out
.println("fileformat length=" + fileformat.length);
out.write(filelength);
out.flush();
String strok1 = readFromSocket(in);
System.out.println("service receive filelength :" + strok1);
System.out.println("write data to android");
out.write(filebytes);
out.flush();
System.out.println("*********");
String strread = readFromSocket(in);
System.out.println(" send data success:" + strread);
System.out
.println("=============================================");
} else if (strWord.equalsIgnoreCase("EXIT")) {
out.write("EXIT".getBytes());
out.flush();
System.out.println("EXIT finish sending the data");
String strFormsocket = readFromSocket(in);
System.out.println("the data sent by server is:/r/n"
+ strFormsocket);
flag = false;
System.out
.println("=============================================");
} catch (UnknownHostException e1) {
System.out.println("TCP 331133" + "ERROR:" + e1.toString());
} catch (Exception e2) {
System.out.println("TCP 441144" + "ERROR:" + e2.toString());
} finally {
if (socket != null) {
socket.close();
System.out.println("socket.close()");
} catch (IOException e) {
System.out.println("TCP 5555" + "ERROR:" + e.toString());
public static String readFromSocket(InputStream in) {
int MAX_BUFFER_BYTES = 4000;
String msg = "";
byte[] tempbuffer = new byte[MAX_BUFFER_BYTES];
int numReadedBytes = in.read(tempbuffer, 0, tempbuffer.length);
msg = new String(tempbuffer, 0, numReadedBytes, "utf-8");
tempbuffer = null;
} catch (Exception e) {
e.printStackTrace();
android服务器端:
主类androidService.java
package com.otheri.
import java.io.F
import java.io.IOE
import java.net.ServerS
import java.net.S
import android.app.S
import android.content.BroadcastR
import android.content.C
import android.content.I
import android.content.IntentF
import android.os.IB
import android.util.L
public class androidService extends Service {
public static final String TAG = "TAG";
public static Boolean mainThreadFlag = true;
public static Boolean ioThreadFlag = true;
ServerSocket serverSocket = null;
final int SERVER_PORT = 10086;
File testF
private sysBroadcastReceiver sysBR;
public void onCreate() {
super.onCreate();
Log.v(TAG, Thread.currentThread().getName() + "----&" + "
onCreate");
sysRegisterReceiver();
new Thread() {
public void run() {
doListen();
}.start();
private void doListen() {
Log.d(TAG, Thread.currentThread().getName() + "----&"
+ " doListen() START");
serverSocket = null;
Log.d(TAG, Thread.currentThread().getName() + "----&"
+ " doListen() new serverSocket");
serverSocket = new ServerSocket(SERVER_PORT);
boolean mainThreadFlag = true;
while (mainThreadFlag) {
Log.d(TAG, Thread.currentThread().getName() + "----&"
+ " doListen() listen");
Socket client = serverSocket.accept();
new Thread(new ThreadReadWriterIOSocket(this, client)).start();
} catch (IOException e1) {
Log.v(androidService.TAG, Thread.currentThread().getName()
+ "----&" + "new serverSocket error");
e1.printStackTrace();
private void sysRegisterReceiver() {
Log.v(TAG, Thread.currentThread().getName() + "----&"
+ "sysRegisterReceiver");
sysBR = new sysBroadcastReceiver();
IntentFilter filter1 = new IntentFilter();
filter1.addAction("android.intent.action.PACKAGE_ADDED");
filter1.addDataScheme("package");
filter1.addAction("android.intent.action.PACKAGE_REMOVED");
filter1.addDataScheme("package");
registerReceiver(sysBR, filter1);
private class sysBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equalsIgnoreCase("android.intent.action.PACKAGE_ADDED")) {
} else if (action
.equalsIgnoreCase("android.intent.action.PACKAGE_REMOVED")) {
Log.v(TAG, Thread.currentThread().getName() + "----&"
+ "sysBroadcastReceiver onReceive");
public void onDestroy() {
super.onDestroy();
mainThreadFlag = false;
ioThreadFlag = false;
Log.v(TAG, Thread.currentThread().getName() + "----&"
+ "serverSocket.close()");
serverSocket.close();
} catch (IOException e) {
e.printStackTrace();
Log.v(TAG, Thread.currentThread().getName() + "----&"
+ "**************** onDestroy****************");
public void onStart(Intent intent, int startId) {
Log.d(TAG, Thread.currentThread().getName() + "----&" + " onStart()");
super.onStart(intent, startId);
public IBinder onBind(Intent arg0) {
Log.d(TAG, "
return null;
用于接收PC发来的Broastcast并启动主类service的ServiceBroadcastReceiver.java
package com.otheri.
import android.content.BroadcastR
import android.content.C
import android.content.I
import android.util.L
public class ServiceBroadcastReceiver extends BroadcastReceiver {
private static String START_ACTION = "NotifyServiceStart";
private static String STOP_ACTION = "NotifyServiceStop";
public void</span
&&&&推荐文章:
【上篇】【下篇】

我要回帖

更多关于 电脑数据包接收不到 的文章

 

随机推荐