?? Modules for GPIB and Ethernet ??

Cameron Laird claird at lairds.us
Fri Nov 5 14:08:06 EST 2004


In article <roy-F071F5.08483605112004 at reader1.panix.com>,
Roy Smith  <roy at panix.com> wrote:
>In article <21240387.0411050533.4d145e2a at posting.google.com>,
> justinhsia at yahoo.com (Chaser) wrote:
>
>> I have an equipment that's controlled through ethernet.  (The control
>> program is currently written in C++.)  I guess my really difficulty
>> is, how do I send commmands to that devise through ethernet using
>> Python?
>
>You havn't given enough information to give a good answer, but I'll take 
>a shot.
>
>First, you need to know what kind of protocol your device talks.  It's 
>virtually certain that the device implements some kind of custom 
>application-level protocol on top of some standard transport layer such 
>as TCP/IP.  Assuming that's the case, you need to:
>
>1) Find the documentation for the application-level protocol it talks.
>
>2) Find out the IP address (or hostname) of the device.
>
>From within Python, you will need to create a socket, connect the socket 
>to your device using the connect() method, and then use the send() and 
>recv() methods to talk to the device.  You'll need to implement the 
>application-layer protocol yourself.
>
>The details of how to use sockets in Python (i.e. connect(), send(), 
>recv(), etc) are documented in "7.2 socket -- Low-level networking 
>interface" of the Python Library Reference.  To really understand what 
>section 7.2 is talking about, however, you need to have a general feel 
>for how network communication works in general.  Fortunately, the 
>introduction to section 7.2 contains some pointers to some good general 
>reference books.

I'll add that what you're attempting might be essentially impossible,
or extremely easy, or anything in between.  Hardware vendors vary
WIDELY in the "hackability" of what they sell.

It might be worth calling in one of us with experience in networking
and physical devices for at least a small amount of initial consulta-
tion.  It has the potential to save you months (!  yes, I've seen it
take that long to understand a vendor sufficiently well to realize
that a problem has an easy answer).



More information about the Python-list mailing list