Programming and posix - April 2002

April 3, 2002
Solution Symposium
Page 54
hp e3000
programming
and posix
sockets - server example
mysock = socket(AF_INET, SOCK_STREAM, 0);
bind(mysock, <address of port 80>);
listen(mysock, queuedepth);
begin main loop
remotesock = accept(mysock, <remote address>);
read request with read() or recv()
write response with write() or send()
close(remotesock);
end main loop
close(mysock);