input/output through socket or COM port

Jive Dadson jdadson at ix.netcom.com
Sat Apr 27 17:47:52 EDT 2002


I hope this is an easy question, for people who know about Python
internals, or Posix stuff.  This is for an industrial control
application.  Assume that a suitable subset of MS Windows API calls and
Posix API calls are available.

I want to configure Python so it will read and write standard input and
output to and from either a TCP/IP socket or a serial COM port data
link. There will be no terminal or keyboard.

Scenario 1: The Python system will run in standard interactive mode,
accepting input from a client computer on the data link, and compiling
and executing it, just as if a human typed had it into a Python
console.  Prompts and such, plus text generated by "print" commands will
go back to the client computer.

That prompts that it writes in that mode might prove too verbose, so...

Scenario 2: The Python engine reads from the data link and compiles and
executes each line it receives, but does not echo anything back other
than what the user's programs generate with "print" commands.  The
client computer should be able to send new function definitions, just as
in interactive mode. 

I compiled Python under VC++ and used the Visual Studio debugger to step
through the code, but as yet I have not even been able to find where in
the code Python does input/output!

Anyone know how to do this?  Does python use stdio (printf, scanf, etc)
for interactive mode?

Best regards,
Jive



More information about the Python-list mailing list