import java.io.IOException;
Import the Java. IO. InputStream;
The import java.net.ServerSocket;
The import java.net.Socket;
/* *
* goal: use ServerSocket build browser connection, get request protocol
* @ author Administrator
*
*/
Public class Server01 {
Private ServerSocket ServerSocket.
Public static void main (String [] args) {
Server01 server=new Server01 ();
Server. The start ();
}
//start the service
Public void the start () {
Try {
ServerSocket=new serverSocket (8888);
The receive ();
} the catch (IOException e) {
e.printStackTrace();
System. The out. Println (" server startup failure ");
}
}
//accept connections processing
Public void the receive () {
Try {
The Socket client=serverSocket. The accept ();
System. Out.println (" a client connection is established... ");
//get request protocol
InputStream is=client. GetInputStream ();
Byte [] datas=new byte (1024 * 1024),
Int len=is. Read (datas);
String requestInfo=new String (datas, 0, len);
System. The out. Println (requestInfo);
} the catch (IOException e) {
e.printStackTrace();
System. The out. Println (" the client error ");
}
}
//stop service
Public void the stop () {
}
}
Here is the HTML file
<body>
The use of the form & lt;/h1>
Post: submitted, based on the HTTP protocol of large amount of different url request parameter is not visible security
The get: by default, access, small amount of HTTP protocol based on different url request parameter is unsafe
Action: request to the web server's resource URL
Name: used as the back-end, distinguish the only request data server does not exist, cannot submit
Id: used as a front end, distinguish the only
User name: & lt; Input type="text" name="uname" id="uname" & gt;
Password: & lt; Input type="password" name="PWD" id="PWD" & gt;
Post: submitted, based on the HTTP protocol of large amount of different url request parameter is not visible security
The get: by default, access, small amount of HTTP protocol based on different url request parameter is unsafe
Action: request to the web server's resource URL
Name: used as the back-end, distinguish the only request data server does not exist, cannot submit
Id: used as a front end, distinguish the only