port socket fix from 918f59fbe26571f78231f380f3304fd164b19b10 to Windows

see title