public class TestDemo {
public static void main(String[] args) throws Exception {
ServerSocket ss = new ServerSocket(8080);
Socket s = ss.accept();
System.out.println(s.getInetAddress().getHostAddress());
InputStream in = s.getInputStream();
byte[] buf = new byte[1024];
int len = in.read(buf);
System.out.println(new String(buf,0,len));
PrintWriter out = new PrintWriter(s.getOutputStream(),true);
out.println("<font color='red' size='8'>提交成功</font>");
s.close();
ss.close();
}
}
则服务器地址为 http://202.38.203.174:8080
网友评论