SOCKETS IN NACH0S <ul>Socket types: <li>STREAM- Uses TCP which is realiable, stream oriented protocol.
RAW- Provides RAW data transfer directly over IP protocol.
DATAGRAM- Message oriented protocol. </li></ul>
SOCKETS IN NACH0S <ul>Socket use: <li>Unicast
Multicast
Broadcast
Loopback </li></ul>
SOCKETS IN NACH0S <ul>Programming Client-Servidor in JAVA <li>All the class located in the  java.net package.
Stream classes are in the  java.io package.   </li></ul>
Upcoming SlideShare
Loading in...5
×

Sockets in nach0s

863

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
863
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Sockets in nach0s

  1. 1. SOCKETS IN NACH0S <ul>Socket types: <li>STREAM- Uses TCP which is realiable, stream oriented protocol.
  2. 2. RAW- Provides RAW data transfer directly over IP protocol.
  3. 3. DATAGRAM- Message oriented protocol. </li></ul>
  4. 4. SOCKETS IN NACH0S <ul>Socket use: <li>Unicast
  5. 5. Multicast
  6. 6. Broadcast
  7. 7. Loopback </li></ul>
  8. 8. SOCKETS IN NACH0S <ul>Programming Client-Servidor in JAVA <li>All the class located in the java.net package.
  9. 9. Stream classes are in the java.io package. </li></ul>
  10. 10. SOCKETS IN NACHOS <ul>How open a socket? <li>For programming a client, create an object of Socket class. </li></ul>Socket Client; try { Client = new Socket(&quot;Machine name&quot;, PortNumber); } catch (IOException e) { System.out.println(e); }
  11. 11. SOCKETS IN NACH0S <ul><li>For programinng a server, in this part how you open a socket. </li></ul>ServerSocket Service; try { Service = new ServerSocket (PortNumber); } catch (IOException e) { System.out.println(e); }
  12. 12. <ul>When implementing a server you also need create a socket object. </ul>Socket clientSocket = null; try { clientSocket = Service.accept(); } catch (IOException e) { System.out.println(e); } SOCKETS IN NACH0S
  13. 13. SOCKETS IN NACH0S <ul>How to create an imput Stream ? <li>You can use the DataImputStream class . </li></ul>DataInputStream input; try { input = new DataInputStream (Client.getInputStream()); } catch (IOException e) { System.out.println(e); }
  14. 14. SOCKETS IN NACH0S <ul>How to create an output Stream ? <li>To the server socket using the class PrintStream or DataoutputStream of java.io </li></ul>PrintStream output; try { output = new PrintStream (Client.getOutputStream()); } catch (IOException e) { System.out.println(e); }
  15. 15. SOCKETS IN NACH0S <ul>How to close socket? <li>You should always close the output and input stream before you close the socket. </li></ul>try { output.close (); input.close (); Client.close(); } catch (IOException e) { System.out.println(e); }
  1. A particular slide catching your eye?

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

×