60 likes | 186 Views
Networking with Sockets. Java Networking. Java’s networking capabilities are declared by the classes and interfaces of package java.net , through which Java offers stream-based communications that enable applications to view networking as streams of data.
E N D
Java Networking • Java’s networking capabilities are declared by the classes and interfaces of package java.net, through which Java offers stream-based communications that enable applications to view networking as streams of data. • The classes and interfaces of package java.net also offer packet-based communications for transmitting individual packets of information—commonly used to transmit data images, audio and video over the Internet.
client/server relationship • The client requests that some action be performed, and the server performs the action and responds to the client. A common implementation of the request-response model is between web browsers and web servers. When a user selects a website to browse through a browser (the client application), • a request is sent to the appropriate web server (the server application). The server normally responds to the client by sending an appropriate web page to be rendered by the browser.
A Stream socket A process establishes a connection to another process. While the Connection is in place, data flows between the processes in continuous streams
A socket address Is the combination of an IP address and a port number, much like one end of a telephone connection is the combination of a phone number and a particular extension. Based on this address, internet sockets deliver incoming data packets to the appropriate application process
1-Datagramsocket (UDP) also known as connectionless sockets, which use UserDatagram protocol (UDP). 2-Stream socket (TCP) also known as connection-oriented sockets, which use Transmission control protocol(TCP) or Stream control Transmission protocol(SCTP). :Socket types