16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Interprocess Communication<br />

! Comparison of Sockets, TLI, and FIFOs<br />

Sockets TLI FIFOs<br />

Server<br />

allocate space<br />

t_alloc()<br />

create endpoint ocket ( ) t_open ( ) mknod ()<br />

open()<br />

bind address bind ( ) t_bind ( )<br />

specify queue listen()<br />

wait for connection accept() t_listen()<br />

get new fd t_open ( ) t_bind ( )<br />

t_accept ( )<br />

Client<br />

allocate space t_alloc()<br />

create endpoint socket() t_open() open()<br />

bind address bind() t_bind()<br />

connect to server connect() t_connect()<br />

transfer data read() read() read ()<br />

write() write() write() write()<br />

recv() t_rcv()<br />

send() t_snd()<br />

datagrams recvfrom() t_rcvudata()<br />

sendto()<br />

t_sndudata()<br />

terminate close() t_close() close()<br />

shutdown() t_sndrel()<br />

| t_snddis() |<br />

| protocol\server iterative concurrent |<br />

connection-oriented eg Daytime typical 1<br />

| connectionless typical eg TFTP |<br />

! Socket system calls connectionoriented<br />

protocol<br />

Server<br />

socket()<br />

|<br />

bind()<br />

|<br />

listen()<br />

|<br />

accept()<br />

| Client<br />

blocks until connection from client<br />

socket()<br />

| |<br />

| connect()<br />

| |<br />

read() write()<br />

| |<br />

process request| |<br />

| |<br />

write() read()<br />

164

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!