Comments and more improvement.

more logic to not do extra processing. A lot more comments to explain whats happening.
added a very basic logic to timeout if fdset never sets a valid fdmax (can happen with super slow internet or no internet or service down)