Sockets

Summary of : http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets.html

The Unix input/output (IO) paradigm - Open - Read - Write - Close. When the concept of sockets and InterProcess Communication was developed the IO paradigm was used. Sockets effectively enable channels for communication.

IPC is implemented as socket pairs as a layer over the network TCP and UDP protocols with destinations specified as a socket address (ip address and port number). Data is transferred as a message between a socket in one process and a socket in another process. Messages are queued at the sending socket until the network protocol sends them and then at the receiving socket until the receiving process makes the necessary calls to receive them.

Datagram Communication (UDP) - a connectionless protocol, each time you send datagrams you also need to send the local socket descriptor and receiving sockets address (creating additional data that must be sent).

Stream Communication (TCP) - a connection-oriented protocol. One socket listens for a connection request (the Server) whilst another socket asks for a connection (the Client). Once a connection has been established data can be sent in both directions.

UDP TCP
Datagrams Packets
Conectionless Connection-oriented
Size limit of 64 kilobytes on datagrams you can send to a specific location No size limit - a stream is created which allows all available data to be read immediately in the same order it is received
Unreliable Protocol - no guarentee that data sent will be received in the same order sent Reliable Protocol - guarentees that packets sent will be received in the same order
Less complex and has fewer overheads - often used to implement client/server applications in distributed systems over local area networks Useful for implementing network services - remote login, FTP etc which require data of an indefinite length to be transferred

Add new comment

(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.