Eclipse编写socket客户端访问服务端出现如下错误,请高手帮忙
源码:publicstaticStringsend(Stringip,intport,Stringmsg){Stringstr="";try{DataInputStrea...
源码:
public static String send(String ip, int port, String msg) {
String str = "";
try {
DataInputStream in = null;
DataOutputStream out = null;
Socket clientSocket = new Socket(ip, port);
in = new DataInputStream(clientSocket.getInputStream());
out = new DataOutputStream(clientSocket.getOutputStream());
out.writeUTF(msg);
String temp = in.readLine();
while (temp!=null) {
str += temp;
temp = in.readLine();
}
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
str = "Request Timeout";
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
str = "Request or Response Error";
}
return str;
}
调用:
NetWorkUtils.send("192.168.20.90", 6003, msg);
Invalid layout of java.lang.String at value
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (javaClasses.cpp:129), pid=7332, tid=3104
# fatal error: Invalid layout of preloaded class
#
# JRE version: 7.0_09-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.5-b02 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# F:\SVN\ims\trunk\2.DevelopmentLib\3.SourceCode\3C\hs_err_pid7332.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
还会生成一个日志文件hs_err_pid7332.log 展开
public static String send(String ip, int port, String msg) {
String str = "";
try {
DataInputStream in = null;
DataOutputStream out = null;
Socket clientSocket = new Socket(ip, port);
in = new DataInputStream(clientSocket.getInputStream());
out = new DataOutputStream(clientSocket.getOutputStream());
out.writeUTF(msg);
String temp = in.readLine();
while (temp!=null) {
str += temp;
temp = in.readLine();
}
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
str = "Request Timeout";
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
str = "Request or Response Error";
}
return str;
}
调用:
NetWorkUtils.send("192.168.20.90", 6003, msg);
Invalid layout of java.lang.String at value
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (javaClasses.cpp:129), pid=7332, tid=3104
# fatal error: Invalid layout of preloaded class
#
# JRE version: 7.0_09-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.5-b02 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# F:\SVN\ims\trunk\2.DevelopmentLib\3.SourceCode\3C\hs_err_pid7332.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
还会生成一个日志文件hs_err_pid7332.log 展开
4个回答
展开全部
好像是平台不兼容,是64位的 你jdk是64位的么,貌似和jdk版本有关
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
java虚拟机的问题。你不会是循环发数据把虚拟机整垮了吧?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个日志文件记录了你的这个错误的信息
貌似循环有问题
貌似循环有问题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你厉害了,把JAVA都搞崩溃了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询