Improved calculation of flags in SOCKET-SEND and SOCKET-RECEIVE.