Java - Network
Through the classes in
java.net, Java programs can use TCP or UDP to communicate over the Internet. The
ServerSocket classes all use TCP to communicate over the network. The
MulticastSocket classes are for use with UDP.
java.net.URL#equals 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("http://ichart.finance.yahoo.com/table.csv?s=" + ticker); final BufferedReader reader = new BufferedReader( new InputStreamReader(url.openStream()));