On 2012-08-10, loial <jldunn2...@gmail.com> wrote:

> At the moment I do not start to read responses until the data has
> been sent to the printer. However it seems I am missing some
> responses from the printer whilst sending the data, so I need to be
> able to do the 2 things at the same time.
>
> Can I open a port once and then use 2 different threads, one to write
> to the post and one to read the responses)?

By "port" I assume you mean a TCP connection using the 'socket' module?

If so, then yes you can write using one thread and read using a
second thread.  I do that all the time.

Sometimes it's simpler to use a single thread that uses select or
poll, and sometimes it's simpler to use multiple threads.  And you
never know which way is best until you're half way down the wrong
road...


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to