Chapter 5. Network Programming

In today's world, it is not uncommon to have your Linux workstation or server connected to a network. It has become almost a necessity for applications to be network-capable. Knowing how to pass data between network devices is a crucial skill for the professional Linux programmer.

This chapter shows how to add network capabilities to your Linux programs using two different methods. The first method demonstrates how to perform raw socket programming, directly interfacing with the Linux network subsystem. Using this method, you can program any communications protocol required to communicate with any network device.

The second method demonstrates how to utilize prepackaged network programming libraries within your applications. Prepackaged network libraries provide the network programming functions already for you. All you need to do is interface with the library to interact with network devices using common network protocols.

Linux Socket Programming

The UNIX operating system provided many features that revolutionized many things in the programming world. One of these features was file descriptors. A file descriptor provides a programming interface to a file object. Since nearly every object contained in a UNIX system is defined as a file, a file descriptor can be used to send and receive data with lots of different objects on the UNIX system. This makes life much simpler for UNIX (and now Linux) programmers. The same type of programming model works no matter ...

Get Professional Linux® Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.