Compare commits
4 Commits
03b2a4db6e
...
adb994efe6
Author | SHA1 | Date | |
---|---|---|---|
adb994efe6 | |||
191a4f7cff | |||
338ed94a77 | |||
a1f57da200 |
Binary file not shown.
16
API.md
16
API.md
@ -123,9 +123,9 @@ a remote socket to send you data.
|
|||||||
|
|
||||||
##### Returns
|
##### Returns
|
||||||
|
|
||||||
* 0 on timeout
|
* 0 on timeout.
|
||||||
* -1,-2 on error
|
* -1 on error. Use `Socket Errno` for more detail.
|
||||||
* 1 on success
|
* 1 on success.
|
||||||
|
|
||||||
#### RESULT=Socket Async Wait Writing(Socket, Wait_ms)
|
#### RESULT=Socket Async Wait Writing(Socket, Wait_ms)
|
||||||
|
|
||||||
@ -135,9 +135,13 @@ has been completed.
|
|||||||
|
|
||||||
##### Returns
|
##### Returns
|
||||||
|
|
||||||
* 0 on timeout
|
* 0 on timeout.
|
||||||
* -1,-2 on error
|
* -1 on error. Use `Socket Errno` for more detail.
|
||||||
* 1 on success
|
* -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)
|
#### RESULT=Socket Set Timeout(Socket, Wait_ms)
|
||||||
|
|
||||||
|
14
README.md
14
README.md
@ -50,6 +50,10 @@ Reserve As Work 30,1024
|
|||||||
For I=1 To 100
|
For I=1 To 100
|
||||||
If ALREADY_CONNECTED=-1
|
If ALREADY_CONNECTED=-1
|
||||||
RESULT=Socket Wait Async Writing(SOCKET,100)
|
RESULT=Socket Wait Async Writing(SOCKET,100)
|
||||||
|
If RESULT=-3
|
||||||
|
Print "Socket connect failure!"
|
||||||
|
Exit
|
||||||
|
End If
|
||||||
|
|
||||||
If RESULT>0
|
If RESULT>0
|
||||||
ALREADY_CONNECTED=0
|
ALREADY_CONNECTED=0
|
||||||
@ -139,6 +143,11 @@ Doing something cool with the extension?
|
|||||||
most system-friendly way of doing this.
|
most system-friendly way of doing this.
|
||||||
* MiamiDX can be fiddly, at least it is on my MiSTer set up.
|
* MiamiDX can be fiddly, at least it is on my MiSTer set up.
|
||||||
If Internet connectivity is not working, try re-connecting to the network.
|
If Internet connectivity is not working, try re-connecting to the network.
|
||||||
|
* If using Roadshow, `bsdsocket.library` will always be available, so
|
||||||
|
you can't use its presence or lack thereof to test if Internet is available.
|
||||||
|
You'll have to use a combination of DNS lookups and/or connection
|
||||||
|
timeouts using `Socket Async Wait Writing` to determine if the Internet
|
||||||
|
is available.
|
||||||
|
|
||||||
## Versioning
|
## Versioning
|
||||||
|
|
||||||
@ -167,6 +176,11 @@ to contact me.
|
|||||||
|
|
||||||
* First public release
|
* First public release
|
||||||
|
|
||||||
|
### 1.0.1 (2023-04-04)
|
||||||
|
|
||||||
|
* Fix bug in Socket Wait Async Writing where result of getsockopt was
|
||||||
|
incorrectly used.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
### Environment
|
### Environment
|
||||||
|
Binary file not shown.
@ -52,6 +52,10 @@ For I=1 To 100
|
|||||||
If RESULT>0
|
If RESULT>0
|
||||||
ALREADY_CONNECTED=0
|
ALREADY_CONNECTED=0
|
||||||
End If
|
End If
|
||||||
|
If RESULT=-3
|
||||||
|
Print "Unrecoverable error!"
|
||||||
|
Exit
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ALREADY_CONNECTED=0
|
If ALREADY_CONNECTED=0
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
; extension number 18
|
; extension number 18
|
||||||
ExtNb equ 18-1
|
ExtNb equ 18-1
|
||||||
Version MACRO
|
Version MACRO
|
||||||
dc.b "1.0.0-20230401"
|
dc.b "1.0.1-20230403"
|
||||||
ENDM
|
ENDM
|
||||||
VerNumber equ $1
|
VerNumber equ $1
|
||||||
|
|
||||||
@ -1576,6 +1576,7 @@ _DoSocketLibraryClose_Skip:
|
|||||||
;
|
;
|
||||||
; @return
|
; @return
|
||||||
; 1 on success
|
; 1 on success
|
||||||
|
; -1 on error, check Socket Errno
|
||||||
; -2 on library not open
|
; -2 on library not open
|
||||||
; -3 on not interesting yet
|
; -3 on not interesting yet
|
||||||
; 0 on timeout
|
; 0 on timeout
|
||||||
@ -1627,8 +1628,13 @@ _SocketWaitAsyncWriting_LibraryOpen:
|
|||||||
MOVE.L BSDSocketBase-MB(A4),A6
|
MOVE.L BSDSocketBase-MB(A4),A6
|
||||||
CALLLIB WaitSelect
|
CALLLIB WaitSelect
|
||||||
|
|
||||||
TST.L D0 ; timeout, pass through
|
; returns:
|
||||||
BPL _SocketWaitAsyncWriting_Done
|
; * 0 on timeout
|
||||||
|
; * >0 on socket was seen
|
||||||
|
; * -1 on error
|
||||||
|
TST.L D0
|
||||||
|
BEQ _SocketWaitAsyncWriting_Timeout
|
||||||
|
BMI _SocketWaitAsyncWriting_Error
|
||||||
MOVE.L (SP)+,D0 ; D0 contains socket again
|
MOVE.L (SP)+,D0 ; D0 contains socket again
|
||||||
|
|
||||||
Dload A4
|
Dload A4
|
||||||
@ -1667,8 +1673,13 @@ _SocketWaitAsyncWriting_CheckSockopt:
|
|||||||
MOVE.L (SP)+,A3
|
MOVE.L (SP)+,A3
|
||||||
|
|
||||||
TST.L D0
|
TST.L D0
|
||||||
BPL _SocketWaitAsyncWriting_Ready
|
BMI _SocketWaitAsyncWriting_Error
|
||||||
|
|
||||||
|
Dlea IoctlSockOptScratch,A0
|
||||||
|
MOVE.L (A0),D0
|
||||||
|
BEQ _SocketWaitAsyncWriting_Ready
|
||||||
|
|
||||||
|
; still not ready
|
||||||
MOVEM.L (SP)+,A3-A4
|
MOVEM.L (SP)+,A3-A4
|
||||||
MOVE.L #-3,D3
|
MOVE.L #-3,D3
|
||||||
|
|
||||||
@ -1682,11 +1693,20 @@ _SocketWaitAsyncWriting_Ready:
|
|||||||
RestoreStackFunction
|
RestoreStackFunction
|
||||||
Ret_Int
|
Ret_Int
|
||||||
|
|
||||||
_SocketWaitAsyncWriting_Done:
|
_SocketWaitAsyncWriting_Error:
|
||||||
MOVE.L (SP)+,D1
|
MOVE.L (SP)+,D1
|
||||||
MOVEM.L (SP)+,A3-A4
|
MOVEM.L (SP)+,A3-A4
|
||||||
|
|
||||||
MOVE.L D0,D3
|
MOVE.L #-1,D3
|
||||||
|
|
||||||
|
RestoreStackFunction
|
||||||
|
Ret_Int
|
||||||
|
|
||||||
|
_SocketWaitAsyncWriting_Timeout:
|
||||||
|
MOVE.L (SP)+,D1
|
||||||
|
MOVEM.L (SP)+,A3-A4
|
||||||
|
|
||||||
|
MOVEQ #0,D3
|
||||||
|
|
||||||
RestoreStackFunction
|
RestoreStackFunction
|
||||||
Ret_Int
|
Ret_Int
|
||||||
|
Loading…
Reference in New Issue
Block a user