Whitespace
src/socket.c: Fix includes

Fix (partially) comments about why each include was needed
Removes limits.h, which was unused
Add .gitignore
Improve fdopen; document it