socket_as_client.htm |
//import java.lang.reflect.*; import java.io.*; import java.net.*; //import java.util.*; public class Test_this { static public void main( String[] args )throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //frontiersoft.net //manas6:80 System.out.print("Type host name: "); String str = ""; str = br.readLine(); process_this pt = new process_this(); pt.method_parse_url(str); } } class process_this { public void method_parse_url(String str)throws IOException { Socket myclient; try { myclient = new Socket(str, 80); System.out.print("You are connected as client: " + str); } catch (IOException e) { System.out.println(e); System.out.print("Type host name: "); } } } |