80,337
社区成员
发帖
与我相关
我的任务
分享
try {
Toast.makeText(MainActivity.this, "wwwww", Toast.LENGTH_LONG).show();
Socket socket = new Socket("10.55.44.66", 30003);
BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String str = br.readLine();
show.setText(str);
br.close();
socket.close();
} catch (Exception e) {
// TODO: handle exception
}
try {
ServerSocket ss = new ServerSocket(30003);
while(true) {
Socket socket = ss.accept();
InetAddress inetAddress = socket.getInetAddress();
System.out.println(inetAddress.getHostAddress());
System.out.println(inetAddress.getHostName());
OutputStream os = socket.getOutputStream();
os.write("睡你妈逼,起来嗨!".getBytes("utf-8"));
os.flush();
os.close();
socket.close();
}
} catch (Exception e) {
// TODO: handle exception
}
System.out.println(inetAddress.getHostName());