View RSS Feed

Java Socket

Socket programming and networking examples in Java.

  1. Java Networking: URL + URLConnection

    by , 04-25-2012 at 11:31 PM
    Two classes are present in java.net package. URLConnection class & URL class.Client connections are created by these classes to the web servers. Here is a code given as an example:
    Java Code:
    URL url = new URL("http://test.com");
    
    URLConnection urlConnection = url.openConnection();
    InputStream input = urlConnection.getInputStream();
    
    int data = input.read();
    while(data != -1){
        System.out.print((char) data);
        data =
    ...
    Categories
    Tutorial