服务器连接问题?
服务器连接问题?import java.net.*;
import java.io.*;
class mm{
public static void main(String args[])throws Exception{
Socket ss=new Socket();
InetAddress addr = InetAddress.getByName("127.0.0.1");
SocketAddress cc = new InetSocketAddress(addr,300);
//SocketAddress cc=new InetSocketAddress(InetAddress.getByAddress("127.0.0.1".getBytes()),3000);
ss.connect(cc);
//System.out.println("assdsdkd");
}
}
我想那立服务器连接,编译能够通过,可是每次运行都会提示错误!那位帮忙找一下错误呀??
错误提示:
Exception in thread "main" java.net.UnknownHostException: addr is of illegal len
gth
at java.net.InetAddress.getByAddress(Unknown Source)
at java.net.InetAddress.getByAddress(Unknown Source)
at mm.main(mm.java:11)
搜索更多相关主题的帖子:
服务器
----------------解决方案--------------------------------------------------------