robsbots 0 Newbie Poster

Hi all.

I would like to write a network server in C to run on debian linux.
I have some network code thats working, BUT at the same time I want to read data from a serial port, and process it.

I want to build a linux based server to control a robot. This means lots of reading of data from different sources, processing lots of data, reading network sockets and replying.

How can I multiplex all these actions. I need interrupts or threads or non blocking routines.

what I need is.....

int main(){
     while(1)
            {
            read_sensors();               // # Non blocking
            proccess_network_traffic();   // # Non blocking
            proccess_sensor_data();       // # Non blocking
            update_robot();               // # Non blocking
            }
    }

This should loop constanly and proccess tasks as required.

Where should I start ?

Thanks for any pointers you can offer.

Regards
Rob