Network Programming Introduction Based on Classes in the java.net package 6/24/2018 V.B.Sanghavi
Network Terminology IP Address Protocol Port Number Connection-oriented and connectionless protocol Socket 6/24/2018 V.B.Sanghavi
Socket Programming for communication between the machines. The client in socket programming must know two information: IP address Port number 6/24/2018 V.B.Sanghavi
Socket class endpoint for communications between the machines. used to create a socket. Methods: - public InputStream getInputStream() - public OutputStream getOutputStream() - void close() program 6/24/2018 V.B.Sanghavi
ServerSocket class to create a server socket Methods: - public Socket accept() - public InputStream getInputStream() - public OutputStream getOutputStream() - void close() program 6/24/2018 V.B.Sanghavi
URL class - Protocol represents a URL (Uniform Resource Locator) A URL contains many informations. http://www.javatpoint.com : 8080/abc / index.jsp - Protocol - Server name or IP Address - Port Number - File Name or directory name 6/24/2018 V.B.Sanghavi
Methods of URL class public String getProtocol() public String getHost() public String getPort() public String getFile() Program 6/24/2018 V.B.Sanghavi
URLConnection represents a communication link between the URL and the application. can be used to read and write data to the specified resource reffered by the URL. public URLConnection openConnection() 6/24/2018 V.B.Sanghavi
InetAddress class represents an IP address. Methods: public static InetAddress getByName(String host) throws UnknownHostException public static InetAddress getLocalHost() throws UnknownHostException: public String getHostName() l public String getHostAddress() Program 6/24/2018 V.B.Sanghavi