tcp: Check both wfds and efds when waiting for the result from connect

On windows, a connection failure doesn't trigger wfds as it does on unix.

This fixes issue 2237, based on code by yeyingxian.

Originally committed as revision 25154 to svn://svn.ffmpeg.org/ffmpeg/trunk
