Glyph Posted September 12, 2009 Share Posted September 12, 2009 (edited) expandcollapse popupGlobal Const $SCKTCPPROTOCOL = 0 Global Const $SCKUDPPROTOCOL = 0x01 Global Const $SCKCLOSED = 0 Global Const $SCKOPEN = 0x01 Global Const $SCKLISTENING = 0x02 Global Const $SCKCONNECTIONPENDING = 0x03 Global Const $SCKRESOLVINGHOST = 0x04 Global Const $SCKHOSTRESOLVED = 0x05 Global Const $SCKCONNECTING = 0x06 Global Const $SCKCONNECTED = 0x07 Global Const $SCKCLOSING = 0x08 Global Const $SCKERROR = 0x09 Func ConnectTCP($sAddr, $iPort, $iTimeout) Local $oSocket, $timer $oSocket = ObjCreate("MSWinsock.Winsock") $oSocket.Protocol = $SCKTCPPROTOCOL ; set protocol to be tcp $timer = TimerInit() $oSocket.Connect($sAddr, $iPort) While 1 If $oSocket.State = $SCKERROR Then $oSocket = 0 Return -2 ;connection error (will give up for now) EndIf If $oSocket.State = $SCKCONNECTED Then $oSocket.Close $oSocket = 0 Return 0 ;Return $oSocket ; return object for connection EndIf If TimerDiff($timer) > $iTimeout Then $oSocket.Close $oSocket = 0 Return -3 ; connection timeout EndIf WEnd EndFunc ;==>Connect After running that I get this: ==> Variable must be of type "Object".: $oSocket.Protocol = $SCKTCPPROTOCOL $oSocket^ ERROR I see MSWINSCK.OCX in my system32. (It has been unregistered and registered, still did nothing) Do I have to install some special MSWinsock thing? Am I missing something? I hope you can reply. Edited September 12, 2009 by Glyph tolle indicium Link to comment Share on other sites More sharing options...
Ptifou78 Posted November 12, 2010 Share Posted November 12, 2010 up? Link to comment Share on other sites More sharing options...
Richard Robertson Posted November 12, 2010 Share Posted November 12, 2010 Why not just use the built in network functions? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now