Chapter 10. Using Standard I/O on Sockets

The example code in the previous chapters have all used the read(2) or write(2) system calls to perform read and write operations on sockets. The only exception to this rule was recvfrom(2) and sendto(2) function calls, which were used to read and write datagrams. There are application disadvantages to using the simple read(2) and write(2) calls, however.

This chapter will explore

  • How to associate a socket with a FILE stream using fdopen(3)

  • How to create and apply read and write FILE streams

  • Issues concerning closing streams associated sockets

  • Choosing and establishing the correct buffering technique for your FILE streams

  • The interrupted system call issue

Mastery of these topics will give you additional ways ...

Get Linux Socket Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.