linux服务器下发短信功能会报以下异常:
ceshi15:20
16?ヨ?搴?.绀?
ceshi15:20(瓒.骇绠$.?.
--?.??..?.け璐?java.nio.BufferOverflowException
其中ceshi15:20是我的短信内容
windows服务器下正常。
linux下的异常可能不到具体是哪行代码出错,求大师指点。
问题代码如下,供参考:
public static boolean send(String tel, String msg, String sender, String sendDept, String taskid) {
if(!inited)init();
boolean sendFlag = false;
Socket socket = null;
try {
socket = new Socket(serverIp, serverPort);
if (sendBind(socket)) {
try {
if (sendMessage(socket, tel, msg, sender, sendDept)) {
sendFlag = true;
System.out.println("--短消息发送成功。");
}
else {
System.out.println("--短消息发送失败。");
}
}
catch (Exception ex) {
System.out.println("--短消息发送失败:"+ex);
}
}
else {
System.out.println("--短消息发送失败。绑定未成功!");
}
}
catch (Exception e) {
e.printStackTrace();
}
finally {
try {
socket.close();
}
catch (Exception ex) {}
}
if(sendFlag){
dao.updateTask(taskid, 2);
}else{
dao.updateTask(taskid, 1);
}
return sendFlag;
}