Your SlideShare is downloading. ×
0
Socket programming
Socket programming
Socket programming
Socket programming
Socket programming
Socket programming
Socket programming
Socket programming
Socket programming
Socket programming
Socket programming
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Socket programming

1,195

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,195
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
50
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • 07/06/11
  • 07/06/11
  • Transcript

    • 1. SOCKET PROGRAMMING Name:: Gohel Jigar k. ID :: M09018
    • 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. SOCKET logical connection sockets (end points) A socket is an endpoint for communication between two machines.
    • 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. 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. 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. 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. 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. 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. ADVANTAGES SOCKET PROGRAMMING <ul><li>Efficient socket based programming can be easily implemented for </li></ul><ul><li>general communications. </li></ul>
    • 11. THANKS

    ×