mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-11-16 19:48:56 +01:00
ea8e12d32a
FossilOrigin-Name: 6a7ee82ed6b024ee1d8f7a51a9b91a66a8041cde06b53cce649d6bd383ae9677
28 lines
982 B
Text
28 lines
982 B
Text
This implements the Forth part of the socket I/O interface.
|
|
|
|
The sockets interface is low level, and very close to the
|
|
underlying BSD sockets model.
|
|
|
|
~~~
|
|
{{
|
|
'io:Sockets var
|
|
:identify
|
|
@io:Sockets n:zero? [
|
|
#7 io:scan-for dup n:negative?
|
|
[ drop 'IO_DEVICE_TYPE_0004_NOT_FOUND s:put nl ]
|
|
[ !io:Sockets ] choose ] if ;
|
|
---reveal---
|
|
:io:socket-operation identify @io:Sockets io:invoke ;
|
|
}}
|
|
|
|
:socket:gethostbyname (as-) #0 io:socket-operation ;
|
|
:socket:create (-n) #1 io:socket-operation ;
|
|
:socket:bind (sn-n) #2 io:socket-operation ;
|
|
:socket:listen (nn-nn) #3 io:socket-operation ;
|
|
:socket:accept (n-nn) #4 io:socket-operation ;
|
|
:socket:connect (n-nn) #5 io:socket-operation ;
|
|
:socket:send (sn-nn) #6 io:socket-operation ;
|
|
:socket:recv (ann-nn) #8 io:socket-operation ;
|
|
:socket:close (n-) #10 io:socket-operation ;
|
|
:socket:configure (ss-) #11 io:socket-operation ;
|
|
~~~
|