diff --git a/API.md b/API.md index 4f6d5d3..fbba5c4 100644 --- a/API.md +++ b/API.md @@ -125,8 +125,6 @@ a remote socket to send you data. * 0 on timeout. * -1 on error. Use `Socket Errno` for more detail. -* -3 on the socket being sorta-ready. This isn't a connection timeout, - so check again. * 1 on success. #### RESULT=Socket Async Wait Writing(Socket, Wait_ms) @@ -139,8 +137,10 @@ has been completed. * 0 on timeout. * -1 on error. Use `Socket Errno` for more detail. -* -3 on the socket being sorta-ready. This isn't a connection timeout, - so check again. +* -3 on the socket having an error. + * If you're using this function to test for a successful connection and + receive a -3, close and reopen the socket, otherwise subsequent + checks will return 1. * 1 on success. #### RESULT=Socket Set Timeout(Socket, Wait_ms) diff --git a/README.md b/README.md index 26a5b90..69c1fad 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,10 @@ Reserve As Work 30,1024 For I=1 To 100 If ALREADY_CONNECTED=-1 RESULT=Socket Wait Async Writing(SOCKET,100) + If RESULT=-3 + Print "Socket connect failure!" + Exit + End If If RESULT>0 ALREADY_CONNECTED=0 @@ -172,6 +176,11 @@ to contact me. * First public release +### 1.0.1 (2023-04-04) + +* Fix bug in Socket Wait Async Writing where result of getsockopt was + incorrectly used. + ## Development ### Environment diff --git a/examples/HTTP Client Example.amos b/examples/HTTP Client Example.amos index ebcc951..84a1d0a 100644 Binary files a/examples/HTTP Client Example.amos and b/examples/HTTP Client Example.amos differ diff --git a/examples/HTTP Client Example.basic b/examples/HTTP Client Example.basic index f29e981..6d82542 100644 --- a/examples/HTTP Client Example.basic +++ b/examples/HTTP Client Example.basic @@ -52,6 +52,10 @@ For I=1 To 100 If RESULT>0 ALREADY_CONNECTED=0 End If + If RESULT=-3 + Print "Unrecoverable error!" + Exit + End If End If If ALREADY_CONNECTED=0