Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Networking

Networking

Ratings: (0)|Views: 10 |Likes:
Published by Puspala Manojkumar

More info:

Published by: Puspala Manojkumar on Sep 17, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

09/17/2010

pdf

text

original

 
57. What is IP?.IP is Internet Protocol. It is the network protocol which is used to send information from one computer to anotherover the network over the internet in the form of packets.58. What is a port?.A port is an 16-bit address within a computer.Ports for some common Internet Application protocols.File Transfer Protocol-21.Telnet Protocol-23.Simple Mail Transfer Protocol-25.Hypertext Transfer Protocol-80.59.What is hypertext?.Sockets are endpoints of Internet Communication.They are associated with a host address and a portaddress.Clients create client sockets and connect them to server sockets.UDP is a connectionless protocol.MIME(Multipurpose Internet Mail Extension) is a general method by which the content of different types ofInternet objects can be identified.
 
Networking (java.net)Creating a URLtry {// With components.URL url = new URL(“http”,”hostname”, 80, “index.html”);// With a single string.url = new URL(http://hostname:80/index.html”);} catch (MalformedURLException e) {}Parsing a URLtry {URL url = new URL(“http://hostname:80/index.html#_top_ ”);String protocol = url.getProtocol(); // httpString host = url.getHost(); // hostnameint port = url.getPort(); // 80String file = url.getFile(); // index.htmlString ref = url.getRef(); // top} catch (MalformedURLException e) {}Reading Text from a URLtry {URL url = new URL(“http://hostname:80/index.html); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));String str;while ((str = in.readLine()) != null) {process(str);}in.close();} catch (MalformedURLException e) {} catch (IOException e) {}Resolving a HostnameCreating a Client Socket
 
try {InetAddress addr = InetAddress.getByName(“java.sun.com”);int port = 80;Socket sock = new Socket(addr, port);} catch (IOException e) {}Creating a Server Sockettry {int port = 2000;ServerSocket srv = new ServerSocket(port);// Wait for connection from client.Socket socket = srv.accept();} catch (IOException e) {}Reading Text from a Sockettry {BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream()));String str;while ((str = rd.readLine()) != null) {process(str);}rd.close();} catch (IOException e) {}Writing Text to a Sockettry {BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));wr.write(“aString”);wr.flush();} catch (IOException e) {}Sending a Datagrampublic static void send(InetAddress dst,

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->