Network Programming with TCPIP UNIX

Sockets

  • developed for Berkeley UNIX : recall early Berkeley TCP/IP implementation, first delivered with BSD 2.1
  • central features: central abstraction – the socket – an end-point like an electrical connector, not TCP/IP specific (e.g. UNIX named pipes), uses normal read/write system calls, sockets associated with UNIX file descriptors but some not for normal I/O, some extra system calls
  • sits more comfortably with TCP than with UDP because of byte-stream nature of UNIX I/O
  • special UDP functions e.g., recv(…) – accepts a UDP datagram
  • additional non-socket functions e.g., gethostbyname(…) – domain name server

Establishing a TCP Connection
Initial State

  • TCP is connection based … establishing it is a complex multistage process
  • initially all machines are the same
  • no special ‘server’ machines
  • the difference is all in the software

Passive Open

  • server process does a ‘passive’ open on a port
  • it waits for a client to connect
  • at this stage there is no Internet network traffic
  • tells the TCP layer which process to connect to

Active Open

  • client process usually on a different machine
  • performs an ‘active’ open on the port
  • port number at the client end is needed
  • network message -> server machine requests connection

Download file here

Related Manual Guide

Leave a Reply

Search terms : open source code of an application program that runs in a TCP/IP network