I want to achieve that one process should be keep on recieving the data from the client via the socket. another process is a timer task should be keep on running in parallel to call the tasks for every 2ms, 10ms and 100ms. I created a socket to recieve data and also the timer but i dont know how to run this task concurrently. could anyone help me by showing a example ??

没有正确的解决方案

其他提示

It looks like threads might be a better option for you. There is a nice comparison of threads and processes here: When is clone() and fork better than pthreads?

Try looking at these tutorial to get the idea how to program pthreads: http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html

you can use fork() system call to create a child process and run the task concurrently.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top