What is the purpose of URL class of java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the purpose of URL class of java?

Does url class of java defines the url's

16th Sep 2017, 7:41 PM
Shubham more
Shubham more - avatar
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
16th Sep 2017, 7:58 PM
Tashi N
Tashi N - avatar
+ 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.
16th Sep 2017, 8:17 PM
Tashi N
Tashi N - avatar
+ 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
16th Sep 2017, 8:33 PM
Tashi N
Tashi N - avatar
+ 1
and what about Socket class?
16th Sep 2017, 8:10 PM
Shubham more
Shubham more - avatar
0
which port should I define in new socket function and what are its mandatory and optional prameters
16th Sep 2017, 8:19 PM
Shubham more
Shubham more - avatar
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
22nd May 2019, 5:50 AM
rahul kumar
rahul kumar - avatar