The same device is available with a LAN interface and can be used by my
software by employing a port-redirector like the "remserial" program,
however it would be preferable from a user standpoint to have the
capability for using the LAN version of the device built into my software.
Can anyone tell me where I can find information about programming this,
i.e., getting the file descriptor given a server name (or IP address) and
port number?
Thanks for your help.
Regards,
Charles Sullivan
Read the libc.info files.
Somehere on your system, it has C examples too.
/usr/share/info/libc.info*
> The same device is available with a LAN interface and can be
> used by my software by employing a port-redirector like the
> "remserial" program, however it would be preferable from a
> user standpoint to have the capability for using the LAN
> version of the device built into my software.
>
> Can anyone tell me where I can find information about
> programming this, i.e., getting the file descriptor given a
> server name (or IP address) and port number?
$ man socket
http://www.amazon.com/Unix-Network-Programming-Sockets-Networking/dp/0131411551/ref=dp_ob_title_bk
http://www.amazon.com/UNIX-Network-Programming-Interprocess-Communications/dp/0130810819/ref=pd_bxgy_b_img_b
Many network-attached devices support RFC2217:
http://www.faqs.org/rfcs/rfc2217.html
If yours does, you can use the pyserial libarary which contains
RFC2217 support:
http://pyserial.sourceforge.net/
I assume you're writing you application in Python...
--
Grant Edwards grante Yow! I Know A Joke!!
at
visi.com
Often it's quite simple, you do the same things you do when
you talk to a server via a TCP socket, i.e. you first create
a socket with the socket() function and then call connect().
If all that works out you now have a socket descriptor you
can use for communication with the device with read() and
write(). If you need more information in that area I would
recommend that you look up some texts about network pro-
gramming, e.g.
or a book like W. Richard Stevens' "Unix Network Programming".
The more tricky part may be to figure out what you have to
send to the device and interpreting what it returns. You need
to consult the manual for the devive for details. It's possible
that you just have to send some data over the socket just as
with the serial port but there are also more elaborate proto-
cols, like VICP when talking to LeCroy oscilloscopes. And some
devices may use RPC (remote procedure calls) as with Agilent
scopes (VXI-11), in which case you don't open the connection
directly with socket() and conect() but leave it to some func-
tions created with the 'rpcgen' utility with from a template
file for the protocol. And there may be lots more I never ran
into...
Regards, Jens
--
\ Jens Thoms Toerring ___ j...@toerring.de
\__________________________ http://toerring.de
The man page for connect(2) is good starting point.
TCP sockets behave in many ways similarly to serial ports so it should be
fairly easy for you to adapt your application (read(2) and write(2) are
still usable).
--- news://freenews.netfront.net/ - complaints: ne...@netfront.net ---
Thanks Jan, Grant, and Jens for your responses and the good advice.
(This app is programmed in C language.)
Regards,
Charles Sullivan