Java - Network

Updated: 2018-12-03

Through the classes in, Java programs can use TCP or UDP to communicate over the Internet. The URL, URLConnection, Socket, and ServerSocket classes all use TCP to communicate over the network. The DatagramPacket, DatagramSocket, and MulticastSocket classes are for use with UDP. vs is blocking:

Two hosts are considered equivalent if both host names can be resolved into the same IP addresses; else if either host name can't be resolved, the host names must be equal without regard to case; or both host names equal to null. Since hosts comparison requires name resolution, this operation is a blocking operation.


final URL url = new URL("" + ticker);
final BufferedReader reader = new BufferedReader( new InputStreamReader(url.openStream()));