Unix socket code

John Leuner jewel at pixie.co.za
Fri Jan 28 11:51:19 PST 2005


Attached is my code for a 'unix socket' plugin.

To run, you must untar the source files, modify your Makefile:

 $(MAKE) -C src/plugins/smart-console/ncurses
        $(MAKE) -C src/plugins/socket

(add the extra make line)

and then run: make plugins

Then load: 'stest.slate'. (you must have set LD_LIBRARY_PATH before
starting the vm (and you have to restart the vm every time you recompile
the .so))


Notes:

1. I didn't know exactly what headers to include in unixsocket.c, so the
ones I have there are probably linux specific (and wrong)

2. I have created two SocketLocator types (one for names to be looked up
by DNS and one for IP addresses).

My idea was to eliminate a call to gethostbyname if it isn't necessary. 

I suppose calling gethostbyname is irrelevant in terms of speed and
maybe it's best to call it anyway.

3. I haven't implemented any error handling. How do we pass the error
information from C-space to Slate-space and give a meaningful condition?
How do we do this for multiple UNIX platforms (I assume error values may
be different).

How do we integrate error conditions with win32?

4. Some of the code is quite ugly, please suggest fixes if you think I
am missing a concept which would yield cleaner code.

5. I have implemented ReadIntoXX and WriteFromXX methods, but perhaps
these are the same as existing primitives?


John Leuner

-------------- next part --------------
A non-text attachment was scrubbed...
Name: unixsockets.tar.gz
Type: application/x-compressed-tar
Size: 3070 bytes
Desc: not available
Url : /archives/slate/attachments/20050129/a3d652f1/unixsockets.tar.bin


More information about the Slate mailing list