View RSS Feed

sixxvirus

  1. Get the info of a socket

    by , 05-16-2012 at 12:50 AM
    This program reads a list of hostnames from the command-line, attempts to open a socket to each host, and then prints to the remote host, the remote port, and the local address, and the local port.

    ** Happy Coding**

    /* SocketInfo.java
    * Get the info of a socket
    */
    import java.net.*;
    import java.io.*;
    public class SocketInfo{
    public static void main(String[] args){
    for(int index=0; index<args.length; index++){ ...