[newbie] trying socket as a replacement for nc
conorh at conorh.net
Thu Dec 12 00:38:12 CET 2013
Jean Dubois <jeandubois314 at gmail.com> writes:
> I have an ethernet-rs232 adapter which allows me to connect to a
> measurement instrument by means of netcat on a linux system.
> e.g. entering nc 10.128.59.63 7000
> allows me to enter e.g.
> after which I get an identification string of the measurement
> instrument back.
> I thought I could accomplish the same using the python module "socket"
> and tried out the sample program below which doesn't work however:
In what way does it not work? Do you not get any data? Do you get the
wrong data? Does your program block at a point which you do not
Probably more to the point, are you sure you are sending exactly the
same data as you did with netcat? netcat running with stdin a terminal
sends data line-by-line, and includes the newline in the data that it
sends. You didn't send a newline in your example.
More information about the Python-list