Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Charles Dinneya
Added: Jan 17, 2019 10:37 AM
Views: 22
Tags: no tags
  1. package practice;
  2. import java.net.*;
  3. import java.io.*;
  4.  
  5. public class Practice {
  6.  
  7.     public static void main(String[] args) {
  8.            try {
  9.                Socket theSocket = new Socket("apache", 80);
  10.                InetAddress host = theSocket.getInetAddress();
  11.                System.out.print("Connected to remote host " + host);
  12.            } catch(Exception r) {
  13.                System.err.println(r);
  14.            }    
  15.     }
  16. }