The Fortune Server
YOU MAY NOT USE EUCLID FOR THIS ASSIGNMENT. DON'T FORK BOMB
EUCLID. IF YOU
CRASH TURING.NMU.EDU I WON'T BE TOO MAD!!
Summary
Your mission is simple. You are to write a web/telnet server that sends pithy and
sometimes offensive sayings to the client. A person should be able to connect to
your server with either a telnet or a http session. They will request a type of
pithy saying (mild, offensive, or all) and you will provide it.
Details
Open a TCP socket. Wait for a connection. For each connection, do the following
actions:
- Message type = mild
- If they send data within 0.5 seconds
- if the 5th byte is an 'o', message type=offensive
- if the 5th byte is an 'a', message type=all
- fork yourself
- If you're the child
- Dup stdout onto the socket
- exec fortune
- print an error
- call exit
Scoring out of 25 points
Turned in before Monday Nov 10th 5 points
Turned in after Thursday Nov 13th -5 points
Can send one fortune 10 points
Can vary the type of fortune 5 points
Sends when data available or 0.5 sec 5 points
Works with telnet or http 5 points
Every fork bomb of euclid -2 points