23-03-2012, 11:56 AM
Client Server in Java
clientserver.pdf (Size: 38.54 KB / Downloads: 31)
Initializing a Connection
! Socket
» Two way link
between client and
server
! Client Connects to
the port at the
Server
» This creates the
socket
Notes
! Can have several sockets on one port
! Each socket should have its own thread
» Reading and writing can even be in
different threads
! Should perhaps have a limit on number
of threads/sockets handled
! Listening thread creates others.
Advanced Techniques
! Can broadcast to all open sockets
» e.g. Manage a multi-user game.
! Server can connect to other services
and act as an intermediary filter
» e.g. This is how you get gopher and ftp
service from an http server.
! Streams don’t have to be text streams