大家好,
小弟要做tcp 的連線傳值,android端是client
new Thread(new Runnable(){
@Override
public void run() {
try {
// XXX.XXX.XXX.XXX = server ip , xxxx = port
Socket socket = new Socket("xxx.xxx.xxx.xxx", xxxx);
try {
DataOutputStream out;
out = new DataOutputStream(socket.getOutputStream());
// msg = String "xxx";
out.write(msg.getBytes());
out.flush();
out.close();
}
catch (Exception e) {
e.printStackTrace();
}
finally {
socket.close();
}
}
catch (InterruptedException e) {
e.printStackTrace()
}
}).start();
此段就是android傳送值的內容,連續傳送到server端後,會造成server端crash
怎麼想都想不出原因,是否有大大可以指點。
感恩蛤