RPC over {TCP/IP, Serial, Full Duplex FIFOs}

I’ve tinkered a bit further with Lua-RPC, but I’ve still not settled on how I’d like to deal with multiple lower level layers over which it can operate.  Inherently, it should be fairly simple because all the modalities mentioned in the title can be treated like files on UNIX/POSIX.  This means that once setup is complete, so long as no errors are encountered, all of these links should essentially look the same.  With error handling included, perhaps this can be somewhat simplified if we can look up error messages depending on which type of link is in use.The main point of interest, I think, is in allowing any one of these link types to be configured for the same library.  Perhaps the best way to handle this is to have a set of different handle creators (one per link layer), and each one of these takes parameters appropriate for configuration of that link, while leaving a handle that can be used by a common set of utility functions that read and write to the file descriptor set up when the handle was created.Currently there is one RPC_open function for opening client-side connections to a server.  If the namespacing were adjusted so that we have an rpc table, and function entries corresponding to different link types, our adjusted set of “open” functions could look like:h_sock = rpc.open_socket(address,port)h_ser = rpc.open_serial(serial_port, baud, etc..)h_fifo = rpc.open_fifo(file_path)I’m not sure if after setting up the file descriptor that when read() or write() are subsequently called that anything special need be done to ensure that those functions are the ones that know how to work with the link type that has been set up.  I would assume that at least for the serial and fifo situations, where an actual “file” exists to be read and written to that this isn’t too much of a problem, but for the socket there’s no file or fake file to represent the open socket.  Does POSIX/UNIX take care of this for you?  I suppose I’ll just have to check 🙂

Advertisements
Tagged with: ,
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: