Client Server PDF
Client Server PDF
Students:
Cuc Andreea, Lacatus Iustina
Specialization: RI English Class
3rd License Year
Group: 1533e/2
If everything goes well, the server accepts the connection. After that, the server
gets a new socket bound to the same local port and also has its remote endpoint
set to the address and port of the client. It needs a new socket so that it can
continue to listen to the original socket for connection requests while tending to
the needs of the connected client.
catch (NumberFormatException e) {
System.err.println("Error1"); }
}
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(port);
Socket newSock = null;
If the server successfully binds to its port, then the socket object is successfully
created and the server continues to the next step—accepting a connection from a
client :
newSock = serverSocket.accept();
System.out.println("accept");