Your SlideShare is downloading. ×
  • Like
A Short Java Socket Tutorial
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

A Short Java Socket Tutorial

  • 14,871 views
Published

 

Published in Technology , News & Politics
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • I just want to warn those who learns Java Socket API that the provided sample server is not able to handle concurrent connections (there's really no need to override Runnable.run() and start a new thread).
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
14,871
On SlideShare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
498
Comments
1
Likes
5

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

Transcript

  • 1. A Short Java Socket Tutorial Albert Guo [email_address]
  • 2. Agenda
    • Java Socket
    • Interactive Socket Server Lifecycle
    • Lifecycle of a multithreaded socket server
    • Use Case Diagram
    • Class Diagram
    • Socket Server Operations
      • WeatherSocketServer.java
      • Socket Client Operation
      • Socket Server Demo
      • Socket Clients Demo
  • 3. Java Socket
    • A socket is a communication end point
      • Is a network programming interface
      • Is used by a process to communicate with a remote system via a transport protocol.
      • Needs an IP address and a port number
    • Sockets are popularly used in client/server computing
      • Provides two major types of services:
        • Connection-oriented
        • Connectionless
  • 4. Java Socket – cont.
    • Java supports client/server computing using sockets.
      • Java supports both connection-oriented and connectionless services.
      • Java uses Socket for clients and ServerSocket for servers in a connection-oriented environment.
      • Java uses DatagramSocket/DatagramPacket for connectionless services.
  • 5. Interactive Socket Server Lifecycle
  • 6. Lifecycle of a multithreaded socket server
  • 7. Use Case Diagram
  • 8. Class Diagram
  • 9. Socket Server Operations
  • 10. WeatherSocketServer.java
  • 11. WeatherSocketServer.java
  • 12.  
  • 13. Socket Client Operation
  • 14. Socket Client
  • 15. Socket Server Demo Client1’s request Client2’s request
  • 16. Socket Clients Demo Client1 request for Taipei’s weather condition Client1 request for TaoYuan’s weather condition