advanced i/o functions

9
Advanced I/O Functions Advanced I/O Functions Chap 14

Upload: zeph-ruiz

Post on 02-Jan-2016

26 views

Category:

Documents


0 download

DESCRIPTION

Advanced I/O Functions. Chap 14. How to Place Timeouts on Sockets (1). Using SIGALRM signal. Connection timeout 기간의 축소. Response timeout. lib/connect_timeo.c. advio/dgclitimeo3.c. alarm() 은 초 단위 setitimer() 는 micro sec 단위 설정 가능 ( 실제는 msec 단위로 동작 ). - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Advanced I/O Functions

Advanced I/O FunctionsAdvanced I/O Functions

Chap 14

Page 2: Advanced I/O Functions

How to Place Timeouts on Sockets (1)How to Place Timeouts on Sockets (1)

Using SIGALRM signalConnection timeout 기간의 축소 Response timeout

advio/dgclitimeo3.c lib/connect_timeo.c

alarm() 은 초 단위setitimer() 는 micro sec 단위 설정 가능 ( 실제는 msec 단위로 동작 )

Page 3: Advanced I/O Functions

How to Place Timeouts on Sockets (2)How to Place Timeouts on Sockets (2)

select with timeoutadvio/dgclitimeo1.c lib/readable_timeo.c

Page 4: Advanced I/O Functions

How to Place Timeouts on Sockets (3)How to Place Timeouts on Sockets (3)

Using SO_RCVTIMEO and SO_SNDTIMEO socket options Caution: timeout applies to all I/O operations for the

socket descriptor

advio/dgclitimeo2.c

Page 5: Advanced I/O Functions

More on Socket I/O FunctionsMore on Socket I/O Functions

recv and send (only for sockets)

Scatter read and gather write

Page 6: Advanced I/O Functions

More Advanced Socket I/O FunctionsMore Advanced Socket I/O Functions

Page 7: Advanced I/O Functions

Ancillary data -Ancillary data - cmsghdr cmsghdr StructureStructure

Page 8: Advanced I/O Functions

Socket I/O SummarySocket I/O Summary

Page 9: Advanced I/O Functions

Socket and Standard I/OSocket and Standard I/O

Buffering in Standard I/O library fully buffered: all stream except for terminal devices line buffered : terminal devices unbuffered: stderr

Caution Socket 에 standard I/O functions(fgets, fputs) 를 쓰면

fully buffered 됨