CS 574 HW1
The World's Most Useless Daemon
Due Monday, September 23
For this assignment, I want you to create the world's most useless
daemon. Here's what it does: you pass it a string, which is a 32-bit
integer expressed in standard C notation (so the number is decimal
unless it starts with a 0 (in which case it's octal), unless it starts
with 0x (in which case it's hexadecimal)). The server responds with
the 32-bit binary equivalent, in standard network byte order.
In a bit more detail, the server must:
- Create a TCP socket, and bind it to port 8765
- Sit and wait for connections
- When a process connects to it, fork a child to manage the
connection, and sit and wait for more connections.
- Meanwhile, the child sits and communicates with the client
process. The client process sends it integers in C's standard
format, separated by spaces. Whenever the child receives a
value, it converts it to binary, converts the binary to network
byte order, and sends it back.
A few notes:
- It must run under Linux. I mean it. If you don't know
what OS your customary workstation runs, find out.
- Pay attention to the coding
standards
- Write a reasonably efficient program. Don't, for
example, read the input one byte at a time.
Last modified: Mon Sep 16 11:24:02 MDT 2002