Daemons and Networking
2007
These are the notes on my guest lectures on the course C/C++ 2007, at
the State University of Groningen (RuG), Netherlands, where I was
graciously asked by Dr. F. B. Brokken to give two closing
lectures on a specialized subject. This document is also
available in PDF format. The code samples in
this document are available in source form. An accompanying presentation is also
available in PDF.
Table of Contents
- 2.1.1: Forking daemon, version 0
- 2.1.2: Forking daemon, version 1
- 2.1.3: Forking daemon, alternative version
- 2.5.1: How signals work
- 2.5.1.1: Defining a signal handler
- 2.5.1.2: Triggering a signal
- 2.5.1.3: Sample program
- 3.1.1: How to handle connection timeouts
- 3.1.2: Putting it all together
- 3.1.3: Handling connect() timeouts in multithreaded programs
- 3.2.1: Looped socket IO
- 3.2.2: Handling read- and write timeouts
- 1.2.1: portfw.h: The central header
- 1.2.2: The main function
- 1.2.3: Messaging-related functions: error(), warn(), msg()
- 1.2.3.1: error()
- 1.2.3.2: warn()
- 1.2.3.3: msg()
- 1.2.4: Service-related functions
- 1.2.4.1: service_start()
- 1.2.4.2: service_run()
- 1.2.4.3: service_thread()
- 1.2.4.4: service_connect()
- 1.2.4.5: service_stop()
- 1.2.5: Other support functions
- 1.2.6: The Makefile