0
SOCKET PROGRAMMING Name:: Gohel Jigar k. ID :: M09018
WHAT IS SOCKET <ul><li>To establish a connection between one host and another in a network. </li></ul><ul><ul><li>Ends poi...
SOCKET logical connection sockets (end points) A socket is an endpoint for communication between two machines.
TOW TYPE OF  SOCKET   <ul><li>Server sockets </li></ul><ul><ul><li>Wait for requests to come in over the network </li></ul...
SERVER VR. CLIENT SOCKET <ul><li>Server socket: waiting for connection requests </li></ul><ul><li>Client socket: transmiss...
SERVER  SOCKET <ul><li>Constructors </li></ul><ul><li>The constructors used to server socket are given below. All of  them...
SERVER  SOCKET <ul><li>Methods </li></ul><ul><li>Some method defined in the Server Socket are:  </li></ul>Methods   Descri...
CLIENT  SOCKET <ul><li>Constructors </li></ul><ul><li>The constructors used to server socket are given below. All of  them...
CLIENT  SOCKET <ul><li>Methods </li></ul><ul><li>Some method defined in the Server Socket are:  </li></ul>Methods   Descri...
ADVANTAGES  SOCKET PROGRAMMING <ul><li>Efficient socket based programming can be easily implemented for </li></ul><ul><li>...
THANKS
Upcoming SlideShare
Loading in...5
×

Socket programming

1,207

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,207
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
50
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 07/06/11
  • 07/06/11
  • Transcript of "Socket programming"

    1. 1. SOCKET PROGRAMMING Name:: Gohel Jigar k. ID :: M09018
    2. 2. WHAT IS SOCKET <ul><li>To establish a connection between one host and another in a network. </li></ul><ul><ul><li>Ends points of two-way communications, i.e., logical connections between hosts </li></ul></ul><ul><ul><li>Can be used to send and receive data </li></ul></ul><ul><ul><li>Server vs. client sockets </li></ul></ul>
    3. 3. SOCKET logical connection sockets (end points) A socket is an endpoint for communication between two machines.
    4. 4. TOW TYPE OF SOCKET <ul><li>Server sockets </li></ul><ul><ul><li>Wait for requests to come in over the network </li></ul></ul><ul><ul><li>Implemented by java.net.ServerSocket class </li></ul></ul><ul><li>Client sockets </li></ul><ul><ul><li>Used to send and receive data </li></ul></ul><ul><ul><li>Can be thought of as a pair of input and output streams </li></ul></ul><ul><ul><li>Implemented by java.net.Socket class </li></ul></ul>
    5. 5. SERVER VR. CLIENT SOCKET <ul><li>Server socket: waiting for connection requests </li></ul><ul><li>Client socket: transmission of data </li></ul>server socket connection request client socket
    6. 6. SERVER SOCKET <ul><li>Constructors </li></ul><ul><li>The constructors used to server socket are given below. All of them throw IO Exception </li></ul><ul><li>Server Socket(int port) </li></ul><ul><li>Server Socket(int port , int q) </li></ul>
    7. 7. SERVER SOCKET <ul><li>Methods </li></ul><ul><li>Some method defined in the Server Socket are: </li></ul>Methods Description accept() Waits for a connection request and returns a Socket getInetAddress() Returns the local address of this server Socket Int getLocalPort() Returns the port number on which this socket is listening close() Stops waiting for requests from clients
    8. 8. CLIENT SOCKET <ul><li>Constructors </li></ul><ul><li>The constructors used to server socket are given below. All of them throw IO Exception </li></ul><ul><li>Socket(String host, int port) </li></ul><ul><li>Socket(inetAddress address, int port , inetAddress localadrs, int localport ) </li></ul>
    9. 9. CLIENT SOCKET <ul><li>Methods </li></ul><ul><li>Some method defined in the Server Socket are: </li></ul>Methods Description getInetAddress() Returns IP address to which socket are connected. getLocalAddress() Returns local address to which socket are connected. getInputStream() Returns an InputStream for receiving data. getOutputStream() Returns an OutputStream to send data. close() Closes the socket connection.
    10. 10. ADVANTAGES SOCKET PROGRAMMING <ul><li>Efficient socket based programming can be easily implemented for </li></ul><ul><li>general communications. </li></ul>
    11. 11. THANKS
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×