libpq:  use pgsocket for socket values, for portability

Previously, 'int' was used for socket values in libpq, but socket values
are unsigned on Windows.  This is a style correction.

Initial patch and previous PGINVALID_SOCKET initial patch by Joel
Jacobson, modified by me

Report from PVS-Studio
docs: properly document psql auto encoding mode

In psql, both stdin and stdout must be terminals to get a client
encoding of 'auto'.

Patch by Albe Laurenz

Backpatch to 9.3.