0
37kviews
Short Note: Berkeley Socket
1 Answer
5
2.6kviews

Socket:

  1. Sockets are a service provided by transport layer.
  2. A socket is one endpoint of a two-way communication link between two programs running on the network.

Berkeley Socket:

  1. Berkeley sockets is an application programming interface (API) for Internet sockets and UNIX domain sockets.
  2. It is used for inter-process communication (IPC).
  3. It is commonly implemented as a library of linkable modules.
  4. It originated with the 4.2BSD UNIX released in 1983.

Primitive used in Berkeley Socket:

enter image description here

Socket Programming:

I) Server side:

 Server startup executes SOCKET, BIND & LISTEN primitives.

 LISTEN primitive allocate queue for multiple simultaneous clients.

 Then it use ACCEPT to suspend server until request.

 When client request arrives: ACCEPT returns.

 Start new socket (thread or process) with same properties as original, this handles the request, server goes on waiting on original socket.

 If new request arrives while spawning thread for this one, it is queued.

 If queue full it is refused.

II) Client side:

 It uses SOCKET primitives to create.

 Then use CONNECT to initiate connection process.

 When this returns the socket is open.

 Both sides can now SEND, RECEIVE.

 Connection not released until both sides do CLOSE.

 Typically client does it, server acknowledges.

Please log in to add an answer.