我的网络有问题...
protected Void doInBackground(Void... arg0) {
int nreq = 1;
System.out.println("Hall000");
try {
ServerSocket sock = new ServerSocket(6677);
sock.setReuseAddress(true);
sock.setSoTimeout(1000);
Socket newsock = sock.accept();
System.out.print("\n");
System.out.println("Creating command...");
System.out.print("\n");
new answercall();
nreq++;
System.out.println(nreq);
final DataInputStream din = new DataInputStream(
ss.getInputStream());
// Einlesen
diny1 = (din).read();
diny2 = (din).read();
diny3 = (din).read();
diny4 = (din).read();
diny5 = (din).read();
diny6 = (din).read();
diny7 = (din).read();
System.out.println("diny" + diny1 + " " + diny2 + " "
+ diny3 + " " + diny4 + " " + diny5 + " " + diny6
+ " " + diny7);
setDiny1(diny1);
setDiny2(diny2);
setDiny3(diny3);
setDiny4(diny4);
setDiny5(diny5);
setDiny6(diny6);
setDiny7(diny7);
System.out.println(diny1 + " " + diny2 + " " + diny3 + " "
+ diny4 + " " + diny5 + " " + diny6 + " " + diny7
+ " " + diny8);
getSharedPreferences(DINY, MODE_PRIVATE).edit()
.putInt(DINY1, diny1).commit();
getSharedPreferences(DINY, MODE_PRIVATE).edit()
.putInt(DINY2, diny2).commit();
getSharedPreferences(DINY, MODE_PRIVATE).edit()
.putInt(DINY3, diny3).commit();
getSharedPreferences(DINY, MODE_PRIVATE).edit()
.putInt(DINY4, diny4).commit();
getSharedPreferences(DINY, MODE_PRIVATE).edit()
.putInt(DINY5, diny5).commit();
getSharedPreferences(DINY, MODE_PRIVATE).edit()
.putInt(DINY6, diny6).commit();
getSharedPreferences(DINY, MODE_PRIVATE).edit()
.putInt(DINY7, diny7).commit();
} catch (Exception e) {
System.out.println("IO error" + e);
}
return null;
}
LogCat 告诉我:
IO 错误java.net.BindException:绑定失败:EADDRINUSE(地址已在使用中)
我知道这意味着什么,但我不知道,它为什么来...我正在使用重用,所以它不应该来,不是吗?我做错了什么?