home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
internet
/
socketfs_2
/
!Readme
next >
Wrap
Text File
|
1997-09-07
|
7KB
|
143 lines
SocketFS Readme
===============
This is the 'Readme' for the first ALPHA release of socketfs, a socket
filing system for RISC-OS.
As it is the first ALPHA release, socketFS undoubtely has many bugs,
please feel free to e-mail with details of any (or all) bugs you find,
although I would ask you to first check see if the Bugs is alreadly
known by checking the distrubutions BUGS and FAQ files.
I would also ask you to e-mail me any and let me know if you find it
useful.
What does it do then?
---------------------
Quite simply socketfs allows you to open a BSD socket as if it were a
file. SocketFS allows multiple type of addressing to be using and you
can easily add you own function to map filenames to sockets, although at
this stage new functions have to be assembled in, the underlying
mechanism is extensiable and if enough interest is shown, a
SWI SocketFS_RegisterAddressType or simliar could be implemented.
SocketFS uses the specialfield to decide which mapping to use, currently
the only mapping supported is 'IPv4'. This is probaly a bad name for it
as the mapping is really based on gethostbyname(). This is also the
default specialfield. Using any other special field will result in a
file not found or similiar.
Currently any socket which you can open with a Internet module (eg. Acorn
Internet or FreeNet) can be opened with socketfs.
How do I use it?
----------------
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
map - Defaults to 'IPv4', and can be either 'IPv4' or 's2fd'.
T
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!)
File%=OPENOUT("ADFS::4.$.webpage")
Web%=OPENUP("socketfs::tcp.$.www/demon/co/uk\www")
A$ = "GET /index.html"
BPUT#Web%,A$
BPUT#Web%,10 : REM Write end of line...
WHILE NOT EOF#Web%
BPUT#File%,BGET#Web%
ENDWHILE
CLOSE#Web% :REM Release this at end of tcp stream...
CLOSE#File%
OSCLI("settype adfs::4.$.webpage faf"):REM faf=html
Ok, So what use is it
---------------------
Well it makes internet sockets slightly easier to use, and allow you
to treat them like files. Specifically the UnixLib people might find it
useful to allow file operations on sockets as you can in Unix. Although
at the moment listen(), accept() are slightly difficult.
Is there anything it can't do that I should now about
-----------------------------------------------------
I haven't spend anytime working on the implentation of whole file
operations, so *save may or may not work. NO Guarantees.
Also socketfs: does not support renaming as IP essentialy doesn't
allow streams to move between sockets (or interfaces). I might use this
file system semantics for accept() later though.
Finally it has one other feature, the current version of the module uses
blocking sockets, although this means it will wait for data on a socket
withouy returning a error if there is none waiting. One of two things
will then happen, first it will hang the whole machine, or if you're running
freenet or Acorn Internet 5.00 or higher just that taskwindow.
Freenet still has the disadvantage that fileswitch/taskwindow seem to
block other FS calls to thesame handle while the first is waiting. This
is fine for simplex and half-duplex protocols but if you need full-duplex
across Taskwindows, your could recompile the module with -DFIOMODE=FIONBIO
which will force the module to use non-blocking sockets as default.
Final Comments
--------------
It would be nice to add ioctl, and socket_select fuctionality to the
filing system, but I haven't come up with a nice way of doing those
yet. While my own SWI interace would work - bear in mind that socketfs uses
fileswitch to do the SocketHandle<-->FileHandle mapping, so socketfs can't
do this itself as it knows nothing about fileswitch's handles.
I suppose it would be possible to attribute and filetype, assigning different
meanings to these than is usual, but it's not a nice solution.
I'll take a moment here to remind you that socketFS is
distrubuted under the conditions outlined in the accompanying file called
'COPYING', currently this is version 2 of the GPL, however I find GPLs virus
like ablities a little harsh for my tastes, so you'll find me relatively open
on allowing limited distributions under other licenses.
I would also ask you to let me know your experiences, with the software
by e-mail if possible.
I will also welcome bug reports and patches (context diffs please), and
feature requests. I can be reached at <rgammans@compsurg.demon.co.uk>,
and could I please ask if you do e-mail me, can you mention socketfs in
the subject line.
Roger Gammans
18 Aug 1997