Socket toString Example

Socket class toString example. This example shows you how to use toString method.


Socket class toString example. public String toString() Converts this socket to a String.

Here is the code
/*
 * @ # ToString.java
 * A class repersenting use to toString method 
 * of Socket class in java.net package
 * version 17 June 2008
 * author Rose India 
 */

import java.net.*;

public class ToString {

    public static void main(String args[]) throws Exception {

        Socket socket = new Socket();

        //Connects this socket to the server.
        socket.connect(new InetSocketAddress("192.168.10.211"8080));
        System.out.println(socket.toString());
        socket.close();
    }
}

Socket[addr=/192.168.10.211,port=8080,localport=44006]

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US