+ 1
What is the purpose of URL class of java?
Does url class of java defines the url's
6 Answers
+ 9
'Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web. A resource can be something as simple as a file or a directory, or it can be a reference to a more complicated object, such as a query to a database or to a search engine.'
Source:
https://docs.oracle.com/javase/8/docs/api/java/net/URL.html
+ 7
Google: Java Socket
and you'll find the language reference that tells you everything about it ;)
Ask if you have any particular question on it.
+ 7
Parameters -> language reference or Oracle tutorials about sockets:
https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html
https://docs.oracle.com/javase/tutorial/networking/sockets/index.html
Port: the port which is defined/accepted by the counterpart socket.
Example:
https://stackoverflow.com/questions/2165006/simple-java-client-server-program
+ 1
and what about Socket class?
0
which port should I define in new socket function and what are its mandatory and optional prameters
0
The java.net.ServerSocket class represents a server socket. It is constructed on a particular port. Then it calls accept() to listen for incoming connections. accept() blocks until a connection is detected. Then accept() returns a java.net.Socket object you use to perform the actual communication with the client.
There are three constructors that let you specify the port to bind to, the queue length for incoming connections, and the IP address to bind to:
public ServerSocket(int port) throws IOException
public ServerSocket(int port, int backlog) throws IOException
public ServerSocket(int port, int backlog, InetAddress bindAddr)
throws IOException
The accept() and close() methods provide the basic functionality of a server socket.
public Socket accept() throws IOException
public void close() throws IOException
More....
http://net-informations.com/java/net/socket.htm