Fix for the strange behavior seeing with sockets when switched to g++, reported in TRQ-1425.