[Home] [About Me] [My Software] [Acknowledgements]

SocketFs Homepage


Socketfs is a filing system for Acorn's RISC-OS platform. It is special in the sense that it does not provide any long term storage.

This is because it is intended to provide an alternative to the BSD sockets API for 'internet' programs. I also thought it might help port UN*X programs to Risc-OS as you can now get a file descriptor on a socket - so that all those OS_FILE and other calls to sockets can work. You can also do wild things like *type mylinuxbox\daytime to report the current time on a remote un*x machine. Or even *type mylinuxbox\systat to what process are currently running. Assuming of course this port isn't blocked for security.


Like any other streaming filesystem. Open a file and write to it, the only clever bit you need to know about is the filename. Lets examine a possible filename field by field. The general format is socketFS#map::proto.$.remote_host\rport.local_host\lport
Part Description
map Defaults to 'IPv4', and can be either 'IPv4' or 's2fd'. 
proto  Generally this will be tcp, although you might be able to get some use out of udp. There are others but these are the only ones the Internet modules support (AFAIK anyway) ergo the only ones I support. Be aware if you try udp or other protocol sockets are created as SOCK_STREAM, which might cause you problems. The 's2fd' mapping currently ignores thsi field, although may use it for flags in a later module version. 
remote_host  This is the machine you want to connect to. Specify the host name the same way as you would for any usual internet program but replace the '.'s with '/' in the reverse manner to risc-os usually does for UNIX filenames. The means www.demon.co.uk becomes www/demon/co/uk . Note that '/' aren't required if the hostname has no dots so just 'localhost will work. In 's2fd' this is a socket handle and a new filehandle is then return bound to this socket. 
rport  This is the port on the remote machine you want to connect to. You can specify it by service name or number. In the example above you would specify '80' or 'www'. (Assuming you where try to download web pages anyway.) 
local_host  This is the first optional part, and specifies which interface on your local machine you wish to initiate the connection from. It uses the same format to remote_host. 
lport  The is another optional part, an specifies which port the socket uses on your local machine. It uses the same format as rport. This and the previous part are passed to the internet module using bind. 
This means if you want to save a web page off, something like this could do the trick. (IN Basic!)

A$ = "GET /index.html"
CLOSE#Web% :REM Release this at end of tcp stream...
OSCLI("settype adfs::4.$.webpage faf"):REM faf=html


SocketFS comes with source, it is GPL'd so feel free to do almost anything with it.
SocketFS is mainly written in handcoded ARMcode as a set of veneer functions between the fileswitch interface and the Internet module (BSD Sockets API), although a small set of C functions exists to handle namespace translation.

As with all open-source and similiar software, please feel free to send bug-reports, or even better patches, after all since you've got the source why wait for me to fix the bugs when you cn do it yourself.

Send me any patches though so the whole FS gets better.


SocketFS 0.01

This is the orginally released version of the program. It is still fine although watch for a sutble bug in the included example program Weber...
[Download Distribution Archive]

SocketFS V0.02 prepatch 1

This prepatch adds a couple of feature's as well as change some other behaviour, related to the Fileswitch Flush, call which could in some circumstances provoke EPIPE.
It now supports testing of EXT#s, which will now return '1' if there is any data in the TCP buffers. This can solve the blocking problem.

Last and probaly least SocketFS now uses an allocated FS number.

[Download Patch]

To Do