Download presentation
Presentation is loading. Please wait.
1
Network Programming Introduction
Based on Classes in the java.net package 6/24/2018 V.B.Sanghavi
2
Network Terminology IP Address Protocol Port Number
Connection-oriented and connectionless protocol Socket 6/24/2018 V.B.Sanghavi
3
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
4
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
5
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
6
URL class - Protocol represents a URL (Uniform Resource Locator)
A URL contains many informations. : 8080/abc / index.jsp - Protocol - Server name or IP Address - Port Number - File Name or directory name 6/24/2018 V.B.Sanghavi
7
Methods of URL class public String getProtocol()
public String getHost() public String getPort() public String getFile() Program 6/24/2018 V.B.Sanghavi
8
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
9
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.