










































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











































Lecture 4
slides are modified from Dave Hollinger Docsity.com
CPE 401/601 Lecture 4 : SocketProgramming Issues (^) Docsity.com 2
CPE 401/601 Lecture 4 : SocketProgramming Issues 5
OS Specific, some won’t do this!
Docsity.com
CPE 401/601 Lecture 4 : SocketProgramming Issues (^) Docsity.com 7
Docsity.com
CPE 401/601 Lecture 4 : I/O Multiplexing 10
STDIN
TCP SOCKET^ STDOUT Docsity.com
while (! done) { if ( (n=read(STDIN_FILENO,…)<0)) if (errno != EWOULDBLOCK) / ERROR / else write(tcpsock,…)
if ( (n=read(tcpsock,…)<0)) if (errno != EWOULDBLOCK) / ERROR / else write(STDOUT_FILENO,…) }
CPE 401/601 Lecture 4 : I/O Multiplexing (^) Docsity.com 13
CPE 401/601 Lecture 4 : I/O Multiplexing (^) Docsity.com 14
CPE 401/601 Lecture 4 : I/O Multiplexing (^) Docsity.com 16
CPE 401/601 Lecture 4 : I/O Multiplexing (^) Docsity.com 17
struct timeval { long tv_sec; / seconds / long tv_usec; / microseconds / } struct timeval max = {1,0};
CPE 401/601 Lecture 4 : I/O Multiplexing (^) Docsity.com 20