ServerSocket serverSocket = null;
int port = 8888;
try {
serverSocket = new ServerSocket(port, 1,
InetAddress.getByName("127.0.0.1"));
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
while (!shutdown) {
Socket socket = null;
InputStream input = null;
OutputStream output = null;
try {
/**
* 循环到此停止,在端口8888接收到一个HTTP请求才会继续
*/
socket = serverSocket.accept();
input = socket.getInputStream();
output = socket.getOutputStream();
} catch (Exception e) {
e.printStackTrace();
continue;
}
}
另外,不知道别人传参用的什么字符集,怎么避免乱码
------解决思路----------------------
https是有协议的,没这么简单的,你这什么都没有,怎么玩