Sunday, 15 April 2012

tcp - Different behavior in connecting to port 0 in windows 2008 32/64 bit -



tcp - Different behavior in connecting to port 0 in windows 2008 32/64 bit -

when run below code in windows 2008 32 bit server, programme flow goes scktest_error() when connect() called.

but when run same code in windows 2008 64 bit server, rte occurs , programme flow goes error:

private sub form_load() on error goto error1 if (not (me.scktest.state = sckconnected)) ' 'log event outbound client mode connectoin if me.scktest.state <> sckclosed me.scktest.close end if ' msgbox "going connect" me.scktest.connect "127.0.0.1", 0 msgbox "connecting" if me.scktest.state = sckconnected msgbox "connected" end if ' end if exit sub error1: msgbox "rte " & err.number end sub private sub scktest_error(byval number integer, description string, byval scode long, byval source string, byval helpfile string, byval helpcontext long, canceldisplay boolean) msgbox "error in connecting" & number end sub

but error 10049 in both servers. can please advice problem code or server behavior.

thanks

port 0 special wildcard allows socket bind random available ephimeral port. after binding successful, can query socket find actual port bound to. such, cannot connect client socket port 0, because not possible server socket hear on port 0 in first place.

tcp windows-server-2008 windows-server-2003 winsock

No comments:

Post a Comment