Watching for a control chracter
I have writen a program that watches a port on the local machine and prints out the contents of each packet it receives to that port.
The main part of the program is in a function monitorLoop, a while loop usesa variable stayAlive to loop as shown below
Code:
int monitorLoop(void)
{
//socket setup code
while (stayAlive == 1)
{
//watch the port
//print the data
}
}
Wha i want to is to watch for an escape character that will shutdown the server insteas of having to use ^z. ( like telnet watches for ctrl ] ) n
Obviously i can't use a scanf or anything like that becuase the program would puase until it receives input, can anyone give me an idea on how to do this#?
using gcc on slackware 10
mtia
I have written into the server to watch for a special stop packet but would like to stop it locally aswell