The original IP specification talks about network masks, and specifies that bits 1 are part of the network address while bits 0 are host. It doesn't require the 1s to be consecutive (the authors thought that was obvious), many implementers took them literally and allowed non-contiguous netmasks. Later corrections did clarify this and stopped the contortions.
The first question would be: "with what Winsock stack?"
As originally shipped, Windows for Workgroups didn't support IP at all. Somewhere along the line (but I'm not sure of the exact date) Microsoft specified the Winsock API. To use it, however, you had to install a Winsock implementation, of which there were a number (Trumpet!, Netscape, KA9Q, to ...
The accepted answer to Windows 98 with 2GB of RAM should be adaptable for Windows 3.1:
download and extract HIMEMX;
edit CONFIG.SYS to load that instead of HIMEM.SYS, and specify /MAX=262144 to limit memory to 256MiB (the practical limit for Windows 3.x).
This will ensure that Windows only sees 256MiB through the XMM, and should allow it to start and run.