What is the difference between a Socket object and a URLConnection object? How are they used
differently, and how are they similar?
Solution
similarities between socket objects and URL conncetion objecct
1)both are used for communication purposes
2)both can read and write the data
differences
URLConnection
1)here communication happens between URL(UNIFORM RESOURCE LOCATOR ) and the
object .
2the methods of URLConnection class forms the object of URLConnection class
sockets:
1)Here the methods are of socket type
2)The socket is bound to an address and listenins for connections

What is the difference between a Socket object and a URLConnection o.pdf

  • 1.
    What is thedifference between a Socket object and a URLConnection object? How are they used differently, and how are they similar? Solution similarities between socket objects and URL conncetion objecct 1)both are used for communication purposes 2)both can read and write the data differences URLConnection 1)here communication happens between URL(UNIFORM RESOURCE LOCATOR ) and the object . 2the methods of URLConnection class forms the object of URLConnection class sockets: 1)Here the methods are of socket type 2)The socket is bound to an address and listenins for connections