Public ServerSocket(int port, int queueLength) throws IOException, BindException?
Submitted by: AdministratorThis constructor creates a ServerSocket on the specified port with a queue length of your choosing. If the machine has multiple network interfaces or IP addresses, then it listens on this port on all those interfaces and IP addresses. The queueLength argument sets the length of the queue for incoming connection requests--that is, how many incoming connections can be stored at one time before the host starts refusing connections. Some operating systems have a maximum queue length, typically five. If you try to expand the queue past that maximum number, the maximum queue length is used instead. If you pass 0 for the port number, the system selects an available port.
For example, to create a server socket on port 5,776 that would hold up to 100 incoming connection requests in the queue, you would write:
try {
ServerSocket httpd = new ServerSocket(5776, 100);
}
catch (IOException e) {
System.err.println(e);
}
The constructor throws an IOException (specifically, a BindException) if the socket cannot be created and bound to the requested port. An IOException when creating a ServerSocket almost always means one of two things. Either the specified port is already in use, or you do not have root privileges on Unix and you're trying to connect to a port from 1 to 1,023.
Submitted by: Administrator
For example, to create a server socket on port 5,776 that would hold up to 100 incoming connection requests in the queue, you would write:
try {
ServerSocket httpd = new ServerSocket(5776, 100);
}
catch (IOException e) {
System.err.println(e);
}
The constructor throws an IOException (specifically, a BindException) if the socket cannot be created and bound to the requested port. An IOException when creating a ServerSocket almost always means one of two things. Either the specified port is already in use, or you do not have root privileges on Unix and you're trying to connect to a port from 1 to 1,023.
Submitted by: Administrator
Read Online Java Network programming Job Interview Questions And Answers
Top Java Network programming Questions
☺ | What is a Thread Pool? |
☺ | What is JHTTP Web Server? |
☺ | What you know about Random Port? |
☺ | What is a Client Tester? |
☺ | Explain A Daytime Server? |
Top Computer Networking Categories
☺ | CCNA Interview Questions. |
☺ | MCSE Interview Questions. |
☺ | CCNP Interview Questions. |
☺ | MCSA Interview Questions. |
☺ | Network Administrator Interview Questions. |