Using TCP Through Sockets
Using TCP Through Sockets Using TCP Through Sockets
pages, which you can access via the man command. Section 2 of the manual corresponds to system calls. To look up the manual page for a system call such as socket, you can simply execute the command “man socket.” Unfortunately, some system calls such as write have names that conflict with Unix commands. To see the manual page for write, you must explicitly specify section two of the manual page, which you can do with “man 2 write” on BSD machines or “man -s 2 write” on System V. If you are unsure in which section of the manual to look for a command, you can run “whatis write” to see a list of sections in which it appears. 38
- Page 1 and 2: Using TCP Through Sockets David Maz
- Page 3 and 4: eturn; } while ((nread = read (fd,
- Page 5 and 6: general, a client wishing to create
- Page 7 and 8: #define FINGER_PORT 79 #define bzer
- Page 9 and 10: they will operate). Following the b
- Page 11 and 12: • int execl(char *path, char *arg
- Page 13 and 14: } close (s); return -1; } return s;
- Page 15 and 16: } } if (cs < 0) { perror ("accept")
- Page 17 and 18: select represents sets of file desc
- Page 19 and 20: • void cb_add (int fd, int write,
- Page 21 and 22: * Make file file descriptor nonbloc
- Page 23 and 24: } xfree (fc->host); xfree (fc->user
- Page 25 and 26: fc->fd = socket (AF_INET, SOCK_STRE
- Page 27 and 28: libasync also provides three classe
- Page 29 and 30: file descriptor into memory managed
- Page 31 and 32: Sometimes you want to do something
- Page 33 and 34: Note the only way to generate point
- Page 35 and 36: • void tcp_nodelay (int fd) sets
- Page 37: } switch (buf.tosuio ()->input (fd)
pages, which you can access via the man command. Section 2 of the manual corresponds<br />
to system calls. To look up the manual page for a system call such as socket, you can<br />
simply execute the command “man socket.” Unfortunately, some system calls such as write<br />
have names that conflict with Unix commands. To see the manual page for write, you must<br />
explicitly specify section two of the manual page, which you can do with “man 2 write”<br />
on BSD machines or “man -s 2 write” on System V. If you are unsure in which section of<br />
the manual to look for a command, you can run “whatis write” to see a list of sections in<br />
which it appears.<br />
38