Presentation is loading. Please wait.

Presentation is loading. Please wait.

Generic Transport Service Primitives Listen –notify Transport layer a call is expected Connect –establish Transport layer connection Send (or Write) Receive.

Similar presentations


Presentation on theme: "Generic Transport Service Primitives Listen –notify Transport layer a call is expected Connect –establish Transport layer connection Send (or Write) Receive."— Presentation transcript:

1 Generic Transport Service Primitives Listen –notify Transport layer a call is expected Connect –establish Transport layer connection Send (or Write) Receive (or Read) –Both could be connectionless Disconnect (or Close)

2 Berkeley Sockets ‘Sockets’ are one of the 2 major Unix network programming application programming interfaces. The other is the System V Transport Layer Interface (TLI). Sockets are biased towards Unix and C. Good references are Doug Comer’s Vol III –both of them!

3 Unix File I/O Unix treats a file as a ‘stream of bytes’ API calls: open, creat, read, write, lseek, close All operate on file descriptors File descriptors are int’s, but represent a more complex structure

4 “Big Picture” User Space OS Space Program Process sd IPPort L R 1.2.3.423 2.3.4.52000 Socket User Space OS Space Program Process sd IPPort L R 2.3.4.52000 1.2.3.423 Socket duplicated “Server”“Client”

5 Socket I/O Transport layer also provides ‘stream of bytes’ type service to the upper layers API calls: –socket: Initialize data structure –bind: set addresses –listen: specify a queue –accept: wait for connection –connect: initiate a connection –read, write, recv, send: transfer data –close, shutdown: terminate connection –recvfrom, sendto: datagrams

6 Overview -- connection Server Client socket()bind()listen() accept() read()connect()socket()bind()write() server blocks Optional(!!)

7 Overview -- connectionless Server Client socket()bind() recvfrom() sendto() socket()bind()recvfrom() server blocks

8 Socket Paradigm Setup is ‘client/server’ because someone has to start the conversation BUT, communication is bidirectional (either end can read or write) Sockets (in Unix) are multiprotocol: –TCP/IP, UNIX, XNS {address families}

9 Server Types Iterative –Receive request, process it, go to next on queue –Best in connection-less environment Concurrent –Receive request, fork process, reset socket –Best when extended interaction is needed

10 Socket ‘Details’ If you don’t want to block on a read, look at the select system call. You’ll need the following includes: –#include Program examples are available on net.


Download ppt "Generic Transport Service Primitives Listen –notify Transport layer a call is expected Connect –establish Transport layer connection Send (or Write) Receive."

Similar presentations


Ads by Google