There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.
Richard Stevens book contains a very good description on that subject. Please consider buying one if you are into network programming.
1) use select and poll
2) use O_NONBLOCK on socket descriptors.
description here:
http://squirl.nightmare.com/medusa/async_sockets.html
regards
Manish regmi