Remove the call to WSAStartup, and the program requires no X display.
As I said, I know winsock uses hidden windows handles to do some things, which is pretty ugly architecturally. However, it seems like it should be possible to not have a display in this case. any ideas?
It looks like the only dependency is from the PostMessageA in dlls/winsock/async.c #514.
The windows version of ws2_32.dll does not link to user32.dll however, it appears to load it on demand. I can see the following strings in it:
USER32.dll TranslateMessage PeekMessageA PostMessageA DispatchMessageA
Seems like it wouldn't be too hard to change the PostMessageA to LoadLibrary/GetProcAddres.
Mike