I was wondering if you can help me with the function called; InetRead().
My scripts are using this function a lot for several conditions and everything works fine!
But sometimes when the server is a little bit buggy of simply not available my script is hanging.
It takes about 90sec before this function returns a Timeout, when i adjust the parameter it still is hanging about 90sec.
The following script is a example where the script is hanging for aprox. 90sec;
; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.geenverbinding.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")
The following script is a example where the script show the Msgbox pretty fast;
; Set Timeout to 2sec AutoItSetOption ("TCPTimeout", 2000) ; Read Website InetRead("http://www.google.nl/",1) ; Show Msgbox before Ending Script. Msgbox(64,"","Finished")
My question now is, what am i doing wrong and/or is there a other way to prevent Hanging the script?
I have had several people ask for this, so I decided to work the algorithm for it and this is the result.
What is it?
A Gateway Proxy Sends and Receives Data Unmodified.
What is it used for?
You can use it as a gateway, relay or router between two known static IP addresses.
More information is in the header of the script.
You will need WSA_NBTCP.au3 from here:
If you have any questions or problems, let me know.
WSA_NBTCP.au3 (Windows Sockets API - Non-Blocking Transmission Control Protocol)
This is an accumulation of WSA code from many sources and modified to suit myself.
These functions have been thoroughly tested using a Local Proxy Server, which
is about the most strenuous test you can use.
Includes my rendition of how a TCPRecv Timeout should work. Also includes a
timewait/timeout using Select for TCP Send, which works great for that function.
You will need a loop to use _WSA_TCPRecv(). An example will be forthcoming in a second post.
- AutoIt Versions: 126.96.36.199 thru 188.8.131.52 (32Bit only).
- TCPStartup() at beginning of script on startup.
- TCPShutDown() and _WSA_Cleanup() on exit.
Download UDF: WSA_NBTCP.au3
Yep yep, this is pretty much an attempt to port the existing project's concept https://socket.io/ to AutoIt's Codebase. So i will not go in to so much detail.
This is how the communication is done http://i.imgur.com/0mMfsBD.png Each client is isolated to the server http://i.imgur.com/rVO2LFb.png Features
Easy API VarType Translation (Example: If the server sends an int, the client will receive an int and vice versa) Fully featured examples Data encryption (Using Autoit's UDF Crypt.au3) Limitations / Drawbacks
It is not possible to Broadcast/Emit objects Only 1D-arrays are allowed to be Broadcasted/Emitted (2D arrays will probably never be supported) Changelog
Version 1.5.0 (This update DOES NOT break scripts)
Added AutoIt like docs under Docs\. The docs are generated so its a 1 to 1 reflection of the UDF headers. Print of documentation Added a production ready server example. Added a new method: _Io_DevDebug which will display useful information when debugging. Added a new method: _Io_SetMaxRecvPackageSize which defaults to whatever _Io_setRecvPackageSize is set to. Added a new method: _Io_setOnPrefix which defaults to _On_ Added a new default client & server event called flood. Flood occurs when exceeding the $__g_io_nMaxPacketSize. $__g_io_nMaxPacketSize is set by _Io_SetMaxRecvPackageSize Fixed the 16 parameter limit when sending data with _Io_Emit, _Io_Broadcast, _Io_BroadcastToAll and _Io_BroadcastToRoom. This works on the same premise that AutoIt's Call Does Fixed a TRUNCATION problem when receiving packages which could cause crashes! Fixed a programming error which caused $__g_ionPacketSize to reset to default 4096 if _Io_Connect or _Io_listenwere called after _Io_setRecvPackageSize Fixed _Io_setEventPreScript and _Io_setEventPostScript They didnt work. Lol. Changed how events are fired so the client cannot crash the server by sending the wrong number of parameters (This also allows for optional parameters on callbacks) Changed _Io_On. The second parameter $fCallback can now be set to null. Doing this, the function assumes that the callback is: _On_<eventName>.
Please see the docs provided
connection Client events
banned Server and Client events
disconnect flood View source on github
Autoit-Socket-IO-1.5.0.zip (NEWEST 2017-12-20)