Hi -
Q: For above do I have to use two different sockets to handle the sending and receiving?
A: No, absolutely not. One socket can do both "sendto()" and "recvfrom()".
Q: Can it be done without threading?
A: Certainly
Q: Considering the server should be listening all the time to minimize the already possible packet losses from using UDP?
A: In this scenario, it doesn't sound like "packet loss" would really be an issue. If it were, the easiest solution is to implement a simple "ACK/Retry" protocol". Or switch from UDP datagrams to TCP connections.
Strong suggestion:
Read Beej's Guide to Network Programming:
http://beej.us/guide/bgnet/
'Hope that helps .. PSM