Compare commits
3 Commits
882ee8cba2
...
2ba9fd6c82
Author | SHA1 | Date |
---|---|---|
John Bintz | 2ba9fd6c82 | |
John Bintz | 12b859eaf3 | |
John Bintz | 8a4235270c |
43
API.md
43
API.md
|
@ -63,8 +63,19 @@ Create a new Internet socket for reading or writing.
|
|||
|
||||
#### RESULT=Socket Connect(Socket to IPAddress$, Port)
|
||||
|
||||
Attempt to connect to a remote host. Currently doesn't
|
||||
support DNS lookups.
|
||||
Attempt to connect to a remote IP address.
|
||||
|
||||
##### Emulation vs. Physical/FPGA Amiga note
|
||||
|
||||
On emulated Amigas (FS-UAE) with emulated `bsdsocket.library`, a failure in
|
||||
`Socket Connect` due to giving the function a bad IP address allows you to reuse
|
||||
the socket. On real or FPGA-based Amiga running real TCP/IP stacks (MiamiDX,
|
||||
Roadshow), the socket will be made unusable and you'll need to
|
||||
`Socket Close Socket` and reopen the socket with whatever parameters necessary.
|
||||
Closing and opening `bsdsocket.library` has the same effect.
|
||||
|
||||
Always close and re-open a socket if you have any `Socket Connect` failure and
|
||||
any non-blocking polling loops time out!
|
||||
|
||||
##### Returns
|
||||
|
||||
|
@ -74,6 +85,7 @@ support DNS lookups.
|
|||
the socket with Socket Select and Socket Getsockopt Int
|
||||
to see if the connection succeeded
|
||||
* -11 port out of range
|
||||
* -13 IP address has zero length
|
||||
|
||||
---
|
||||
|
||||
|
@ -82,7 +94,7 @@ support DNS lookups.
|
|||
Set a server socket to reuse an interface and port that had
|
||||
been used recently. You likely want this if you're building
|
||||
something that listens on a port for connections. This calls
|
||||
setsockopt() for you.
|
||||
`setsockopt()` for you.
|
||||
|
||||
##### Returns
|
||||
|
||||
|
@ -182,6 +194,7 @@ Set a socket to timeout after Wait_ms milliseconds if reading or writing doesn't
|
|||
|
||||
Close a socket.
|
||||
|
||||
|
||||
##### Returns
|
||||
|
||||
* 0 on success
|
||||
|
@ -324,30 +337,6 @@ out. There's no way to set this timeout, or cancel or override it via AMOS.
|
|||
|
||||
String with IP address, or blank string on error.
|
||||
|
||||
---
|
||||
|
||||
#### RESULT=Socket Status(Socket)
|
||||
|
||||
Returns basic connection information about a socket.
|
||||
|
||||
##### Warning
|
||||
|
||||
Since none of the socket processing of this extension happens in the
|
||||
background, you're likely better off using other means to detect
|
||||
socket status.
|
||||
|
||||
* Disconnected: Try a recv and get zero bytes back. Check Socket Errno.
|
||||
* Broken: Try a send. If it fails, check Socket Errno.
|
||||
* Ready: Use the Async Wait functions.
|
||||
|
||||
##### Returns
|
||||
|
||||
Status of socket:
|
||||
|
||||
* 0 = Closed
|
||||
* 2 = Listening
|
||||
* 6 = Connecting
|
||||
* 7 = Connected
|
||||
|
||||
---
|
||||
|
||||
|
|
74
README.md
74
README.md
|
@ -127,6 +127,9 @@ Socket Library Close
|
|||
* [AQUABYSS](https://agedcode.com/agedcode/en/games/aquabyss)
|
||||
* As of April 2023, the extension's been in heavy use for over a month
|
||||
on the client side of the game.
|
||||
* [Hop to the Top: Bunny's Revenge](https://rabbit.robsmithdev.co.uk/)
|
||||
* The game uses this extension to send and receive high score information.
|
||||
I also did some of the art for the game!
|
||||
|
||||
Doing something cool with the extension?
|
||||
[Contact me](https://theindustriousrabbit.com/about) and I'll add it to the list!
|
||||
|
@ -158,7 +161,7 @@ This project uses semantic versioning.
|
|||
|
||||
## License
|
||||
|
||||
Copyright 2023 John Bintz. Licensed under the MIT License.
|
||||
Copyright 2023-2024 John Bintz. Licensed under the MIT License.
|
||||
|
||||
If you use this in your project, and you really want to,
|
||||
throw a link to theindustriousrabbit.com somewhere! You can
|
||||
|
@ -181,14 +184,75 @@ to contact me.
|
|||
* Fix bug in Socket Wait Async Writing where result of getsockopt was
|
||||
incorrectly used.
|
||||
|
||||
## Development
|
||||
### 1.1.0 (2024-02-23)
|
||||
|
||||
* Fix bug in `Dns Get Host Address By Name$` where it assumed AMOS strings are
|
||||
null-terminated. They are not.
|
||||
* Add `Socket Herrno` to aid in debugging resolver errors.
|
||||
|
||||
### 1.1.1 (2024-03-17)
|
||||
|
||||
* Fix bug in `Socket Inet Ntoa$` where the null terminator on the result of
|
||||
calling `Inet_NtoA` was being included in the AMOS string.
|
||||
* Fix crash bug in `Socket Inet Ntoa$` if called with the BSD Socket library
|
||||
was not open.
|
||||
|
||||
### 1.1.2 (2024-03-18)
|
||||
|
||||
* Fix all functions that return strings so that strings work properly
|
||||
in AMOS. While you could kind of use the immediate return value of the
|
||||
string, any future manipulation of that string would fail. This fixes
|
||||
the following functions:
|
||||
* `Socket Inet Ntoa$`
|
||||
* `Dns Get Address By Name$`
|
||||
* `Socket Recv$`
|
||||
|
||||
### 1.1.3
|
||||
|
||||
Internal release.
|
||||
|
||||
### 1.1.4 (2024-04-26)
|
||||
|
||||
* Fix bug in fdset macro where using D3 for a parameter could cause corruption
|
||||
* Copy a null-terminated copy of IP address for `SocketIPAddressPortToSockaddr`
|
||||
* Add test suite to exercise extension functionality
|
||||
* Fix several crash bugs found due to the test suite
|
||||
* Retructure API docs for easier reading
|
||||
|
||||
# Development
|
||||
|
||||
### Environment
|
||||
|
||||
#### Native Amiga
|
||||
|
||||
* Clone the [AMOS Professional source code](https://github.com/AOZ-Studio/AMOS-Professional-Official)
|
||||
* Run `execute absdsocket`
|
||||
* Note that you'll have to fix up some assigns and files in the AMOS Professional
|
||||
source directory. I'll update this README with those changes once I track them down...
|
||||
* Copy `AMOSPro Sources/+lequ.s` to `+LEqu.s`
|
||||
* Generate the socket LVO file in the `src` directory
|
||||
* Install [`fd2pragma`](https://aminet.net/package/dev/misc/fd2pragma) in your path
|
||||
* Download `https://raw.githubusercontent.com/cnvogelg/amitools/master/amitools/data/fd/bsdsocket_lib.fd` to `src`
|
||||
* In a Shell:
|
||||
|
||||
```
|
||||
cd src
|
||||
fd2pragma bsdsocket_lib.fd to "" special 20
|
||||
```
|
||||
|
||||
* Fix up `src/absdsocket` to match your system's setup
|
||||
* In a Shell:
|
||||
|
||||
```
|
||||
cd src
|
||||
execute absdsocket
|
||||
```
|
||||
|
||||
#### Emulated setup (WinUAE, FS-UAE, Amiberry)
|
||||
|
||||
Run `bin/setup` to do most of the setups above.
|
||||
|
||||
### Debugging
|
||||
|
||||
Modify data in the `DebugArea` and read it by `Peek`/`Deek`/`Leek`ing from
|
||||
the base address provided by `Socket Get Debug Area`.
|
||||
|
||||
### Releasing
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
for i in examples/*.amos; do
|
||||
for i in examples/*.amos test/*.amos; do
|
||||
echo "$i"
|
||||
~/Projects/amostools/listamos -e AMOSPro_BSDSocket.Lib "${i}" > "${i%.amos}.basic" 2>/dev/null
|
||||
done
|
||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@
|
|||
; extension number 18
|
||||
ExtNb equ 18-1
|
||||
Version MACRO
|
||||
dc.b "1.1.3-20240417"
|
||||
dc.b "1.1.4-20240426"
|
||||
ENDM
|
||||
VerNumber equ $1
|
||||
|
||||
|
@ -345,7 +345,7 @@ C_Tk dc.w 1,0
|
|||
dc.b "socket close socke","t"+$80,"00",-1
|
||||
|
||||
AddTokenFunction SocketHerrno
|
||||
dc.b "socket herrn","0"+$80,"0",-1
|
||||
dc.b "socket herrn","o"+$80,"0",-1
|
||||
|
||||
; TOKEN_END
|
||||
dc.w 0
|
||||
|
@ -682,8 +682,6 @@ _SocketConnect_SockaddrIn:
|
|||
MOVE.L D0,A0
|
||||
MOVE.L (SP)+,D0
|
||||
|
||||
CLR.W $100
|
||||
|
||||
MOVE.L D0,-(SP)
|
||||
MOVEM.L A0/A3,-(SP)
|
||||
Dload A3
|
||||
|
@ -1374,8 +1372,10 @@ _SocketSelect_PerformSelect
|
|||
PreserveStackFunction
|
||||
EnsureBSDSocketLibrary _SocketInetNtoa_LibraryOpen
|
||||
|
||||
MOVE.L ChVide(A5),D3
|
||||
|
||||
RestoreStackFunction
|
||||
Ret_Int
|
||||
Ret_String
|
||||
|
||||
_SocketInetNtoa_LibraryOpen:
|
||||
MOVE.L D3,D0
|
||||
|
@ -1392,9 +1392,6 @@ _SocketInetNtoA_StringSizeLoop:
|
|||
TST.B (A0)+
|
||||
BNE _SocketInetNtoA_StringSizeLoop
|
||||
|
||||
MOVE.L A0,D3
|
||||
SUB.L A2,D3 ; D3 = length
|
||||
SUBQ #1,D3 ; get rid of the null terminator
|
||||
MOVE.L A0,D4
|
||||
SUB.L A2,D4 ; D4 = length
|
||||
SUBQ #1,D4 ; get rid of the null terminator
|
||||
|
@ -1415,13 +1412,8 @@ _SocketInetNtoA_StringSizeLoop:
|
|||
SUBQ #1,D4
|
||||
|
||||
_SocketInetNtoA_StringCopyLoop:
|
||||
MOVE.B (A2,D3),(A0,D3)
|
||||
DBRA D3,_SocketInetNtoA_StringCopyLoop
|
||||
|
||||
; make the address even
|
||||
EvenOutStringAddress A0,D3
|
||||
|
||||
MOVE.L A0,HiChaine(A5) ; Does L_Demande nuke A5 too?
|
||||
MOVE.B (A2,D4),(A0,D4)
|
||||
DBRA D4,_SocketInetNtoA_StringCopyLoop
|
||||
|
||||
MOVE.L A1,D3 ; string return
|
||||
|
||||
|
@ -2148,7 +2140,12 @@ _SocketCloseSocket_LibraryOpen:
|
|||
Lib_Par SocketHerrno
|
||||
; - - - - - - - - - - - - -
|
||||
PreserveStackFunction
|
||||
EnsureBSDSocketLibrary _SocketHerrno_LibraryOpen
|
||||
|
||||
RestoreStackFunction
|
||||
Ret_Int
|
||||
|
||||
_SocketHerrno_LibraryOpen:
|
||||
; set up tag list memory and place for herrno to go
|
||||
Dlea AcceptScratchArea,A0
|
||||
MOVE.L A0,A2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; BSDSocket.s, list of the library functions on the 26-04-2024 08:23:46
|
||||
; BSDSocket.s, list of the library functions on the 26-04-2024 20:54:05
|
||||
;
|
||||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
L_Cold: set 0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
; BSDSocket.s, library size on the 26-04-2024 08:23:46
|
||||
; BSDSocket.s, library size on the 26-04-2024 20:54:05
|
||||
;
|
||||
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Lib_Size equ 39
|
||||
|
|
|
@ -9,5 +9,4 @@ FAILAT 21
|
|||
copy AMOSPro_System:APSystem/AMOSPro_BSDSocket.lib AMOSPro_System:APSystem/AMOSPro_BSDSocket.lib.bak
|
||||
FAILAT 10
|
||||
copy AMOSPro_BSDSocket.Lib AMOSPro_System:APSystem/
|
||||
;use an amos file here that includes the plugin to quickly build a test program
|
||||
;apcmp "aqua_test_plugin.amos" inclib
|
||||
apcmp "/test/TestSuite.amos" inclib
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,271 @@
|
|||
' BSD Socket Extension Test Suite
|
||||
'
|
||||
' Exercise all known functionality of the extension and write
|
||||
' a report file detailing the result.
|
||||
|
||||
Screen Open 0,640,200,4,Hires
|
||||
|
||||
_FILE_HANDLE=1
|
||||
Dim _CONTEXT$(10)
|
||||
_CONTEXT_INDEX=0
|
||||
|
||||
Global _FILE_HANDLE,_CONTEXT$(),_CONTEXT_INDEX
|
||||
|
||||
Procedure _ADD_TO_REPORT[MESSAGE$]
|
||||
_CONTEXT_STRING$=""
|
||||
For I=0 To _CONTEXT_INDEX-1
|
||||
_CONTEXT_STRING$=_CONTEXT_STRING$+_CONTEXT$(I)
|
||||
If I<>(_CONTEXT_INDEX-1)
|
||||
_CONTEXT_STRING$=_CONTEXT_STRING$+"/"
|
||||
End If
|
||||
Next I
|
||||
_OUTPUT$="["+_CONTEXT_STRING$+"] "+MESSAGE$
|
||||
Print #_FILE_HANDLE,_OUTPUT$
|
||||
Print _OUTPUT$
|
||||
' ensure line is printed on screen to catch crashes
|
||||
Wait Vbl
|
||||
End Proc
|
||||
|
||||
Procedure _BEGIN_CONTEXT[NAME$]
|
||||
_CONTEXT$(_CONTEXT_INDEX)=NAME$
|
||||
_CONTEXT_INDEX=_CONTEXT_INDEX+1
|
||||
End Proc
|
||||
|
||||
Procedure _END_CONTEXT
|
||||
_CONTEXT_INDEX=_CONTEXT_INDEX-1
|
||||
End Proc
|
||||
|
||||
Open Out _FILE_HANDLE,"report.txt"
|
||||
|
||||
_BEGIN_CONTEXT["Socket Library Open"]
|
||||
_BEGIN_CONTEXT["Open Library"]
|
||||
|
||||
_LIBRARY_ADDRESS=Socket Library Open
|
||||
_ADD_TO_REPORT[Str$(_LIBRARY_ADDRESS)]
|
||||
|
||||
_END_CONTEXT
|
||||
|
||||
If _LIBRARY_ADDRESS=0
|
||||
_ADD_TO_REPORT["bsdsocket.library not available, ending tests"]
|
||||
_END_CONTEXT
|
||||
Goto _FINISH_SUITE
|
||||
End If
|
||||
|
||||
_BEGIN_CONTEXT["Double open"]
|
||||
_NEW_LIBRARY_ADDRESS=Socket Library Open
|
||||
_ADD_TO_REPORT[Str$(_NEW_LIBRARY_ADDRESS)]
|
||||
_END_CONTEXT
|
||||
|
||||
_END_CONTEXT
|
||||
|
||||
|
||||
_BEGIN_CONTEXT["Socket Create Inet Socket"]
|
||||
SOCKET=Socket Create Inet Socket
|
||||
_ADD_TO_REPORT[Str$(SOCKET)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket Reuse Addr"]
|
||||
RESULT=Socket Reuse Addr(SOCKET)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket Set Nonblocking"]
|
||||
_BEGIN_CONTEXT["False"]
|
||||
RESULT=Socket Set Nonblocking(SOCKET,False)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["True"]
|
||||
RESULT=Socket Set Nonblocking(SOCKET,True)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_ADD_TO_REPORT["Preserving this state for rest of tests"]
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Dns Get Address By Name$"]
|
||||
|
||||
_BEGIN_CONTEXT["Bad domain name"]
|
||||
IP$=Dns Get Address By Name$("u8dsf93jsdfoiodsoi.sdfjdsoifueru.sadfasdsdasd")
|
||||
Print IP$
|
||||
_ADD_TO_REPORT[IP$]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["localhost"]
|
||||
IP$=Dns Get Address By Name$("localhost")
|
||||
_ADD_TO_REPORT[IP$]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["aminet.net"]
|
||||
IP$=Dns Get Address By Name$("aminet.net")
|
||||
Print IP$
|
||||
_ADD_TO_REPORT[IP$]
|
||||
_ADD_TO_REPORT["Using this IP address for connection tests"]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Returned string can be manipulated"]
|
||||
_ADD_TO_REPORT["Cat"+IP$+"Dog"]
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket Connect"]
|
||||
_BEGIN_CONTEXT["port too high"]
|
||||
RESULT=Socket Connect(SOCKET To IP$,999999)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["blank ip"]
|
||||
RESULT=Socket Connect(SOCKET To "",80)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["invalid ip -- requires reopening failed socket"]
|
||||
RESULT=Socket Connect(SOCKET To "999.999.999.999",80)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket Close Socket"]
|
||||
RESULT=Socket Close Socket(SOCKET)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
' re-set up this socket after a failed connection
|
||||
SOCKET=Socket Create Inet Socket
|
||||
_=Socket Set Nonblocking(SOCKET,True)
|
||||
|
||||
_BEGIN_CONTEXT["aminet IP ("+IP$+") from above"]
|
||||
RESULT=Socket Connect(SOCKET To IP$,80)
|
||||
_ADD_TO_REPORT[Str$(RESULT)+" (ok to be -1, will Wait Async Writing next)"]
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket Wait Async Writing"]
|
||||
|
||||
_BEGIN_CONTEXT["With unconnected socket"]
|
||||
OTHER_SOCKET=Socket Create Inet Socket
|
||||
_=Socket Set Nonblocking(OTHER_SOCKET,True)
|
||||
|
||||
_BEGIN_CONTEXT["2 second timeout"]
|
||||
RESULT=Socket Wait Async Writing(OTHER_SOCKET,2000)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Zero timeout"]
|
||||
RESULT=Socket Wait Async Writing(OTHER_SOCKET,0)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Connected socket"]
|
||||
_BEGIN_CONTEXT["Two second timeout"]
|
||||
RESULT=Socket Wait Async Writing(SOCKET,2000)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Zero timeout"]
|
||||
RESULT=Socket Wait Async Writing(SOCKET,0)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Attempt to get actual connection"]
|
||||
For TRIES=0 To 10
|
||||
RESULT=Socket Wait Async Writing(SOCKET,500)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
If RESULT>0
|
||||
Exit
|
||||
End If
|
||||
Next TRIES
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket Send and Socket Send$"]
|
||||
HTTP_REQUEST_HEADERS$="GET / HTTP/1.0"+Chr$(10)+"Host: amiga"+Chr$(10)+Chr$(10)
|
||||
|
||||
_BEGIN_CONTEXT["Socket send$ first half"]
|
||||
FIRST_HALF$=Left$(HTTP_REQUEST_HEADERS$,10)
|
||||
RESULT=Socket Send$(SOCKET,FIRST_HALF$)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket send second half"]
|
||||
SECOND_HALF_START=Varptr(HTTP_REQUEST_HEADERS$)+10
|
||||
SECOND_HALF_LENGTH=Len(HTTP_REQUEST_HEADERS$)-10
|
||||
RESULT=Socket Send(SOCKET,SECOND_HALF_START,SECOND_HALF_LENGTH)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket wait Async Reading"]
|
||||
_BEGIN_CONTEXT["With unconnected socket"]
|
||||
_BEGIN_CONTEXT["2 second timeout"]
|
||||
RESULT=Socket Wait Async Reading(OTHER_SOCKET,2000)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
_BEGIN_CONTEXT["Zero timeout"]
|
||||
RESULT=Socket Wait Async Reading(OTHER_SOCKET,0)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["With aminet socket"]
|
||||
_BEGIN_CONTEXT["2 second timeout"]
|
||||
RESULT=Socket Wait Async Reading(SOCKET,2000)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Zero timeout"]
|
||||
RESULT=Socket Wait Async Reading(SOCKET,0)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket Recv$ and Socket Recv"]
|
||||
_BEGIN_CONTEXT["Socket Recv$"]
|
||||
_BEGIN_CONTEXT["Read 20 characters"]
|
||||
RESULT$=Socket Recv$(SOCKET,20)
|
||||
_ADD_TO_REPORT[RESULT$]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["String can be manipulated"]
|
||||
_ADD_TO_REPORT["Cat"+RESULT$+"Dog"]
|
||||
_END_CONTEXT
|
||||
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Socket Read"]
|
||||
Reserve As Work 20,20
|
||||
|
||||
_BEGIN_CONTEXT["Read 20 bytes"]
|
||||
RESULT=Socket Recv(SOCKET To Start(20),20)
|
||||
_ADD_TO_REPORT[Str$(RESULT)]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Data was read"]
|
||||
' this value will change in the interpreter as tests run
|
||||
' we are hacking the gibson here
|
||||
BASE$="12345678901234567890"
|
||||
Copy Start(20),Start(20)+20 To Varptr(DEST$)
|
||||
_ADD_TO_REPORT[DEST$]
|
||||
_END_CONTEXT
|
||||
|
||||
Erase 20
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
_FINISH_SUITE:
|
||||
|
||||
_BEGIN_CONTEXT["Socket Library Close"]
|
||||
_BEGIN_CONTEXT["Close"]
|
||||
Socket Library Close
|
||||
_ADD_TO_REPORT["Success"]
|
||||
_END_CONTEXT
|
||||
|
||||
_BEGIN_CONTEXT["Double close"]
|
||||
Socket Library Close
|
||||
_ADD_TO_REPORT["Success"]
|
||||
_END_CONTEXT
|
||||
_END_CONTEXT
|
||||
|
||||
Close 1
|
Loading…
Reference in New Issue