Socket communication and timer application

tcp communication application
i have an application which run in

1)
while()
{in

}
and listens for some request
When a request comes to create a file(containing some data fetch from somewhere)
but i also want to start some timer that after 10/20 min delete that file
But i don't know how to create such timer

2)
Also
now i want to open listening socket (with some other application).this socket will continue listening for alarms send by that application and forward it to other application

but this should not be blocking as the alarm comes it should forward it . this should not be blocking because it will block the other portion of code until and unless it recieves alarm

I read about select . Can it be used in this scenario

It will be great if some body helps me out