服务器连接问题?
import *;import *;
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" addr is of illegal len
gth
at (Unknown Source)
at (Unknown Source)
at mm.main(mm.java:11)