[Tutor] First python-script: a little network client

Steve Spicklemire steve@spvi.com
Fri, 4 Feb 2000 06:06:39 -0500 (EST)


Hi Jochen,

   I think that 'select' does work on the mac (see medusa) so you 
might look into that.

-steve

>>>>> "Jochen" == Jochen Haeberle <listen@MIDRAS.de> writes:

    Jochen> Hi again,

    Jochen> my little currency script now happily runs along. The
    Jochen> response comes very quickly but the client sits and waits
    Jochen> for a rather long time until the connection gets closed or
    Jochen> there's some sort of timeout I presume.

    Jochen> I am doing this on a Mac, where threading is not available
    Jochen> and therefore the socket-connection takes up all processor
    Jochen> time not allowing program switvhing.

    Jochen> Therefore the additional time for waiting for the timeout
    Jochen> is rather bad. I looked through some of the example
    Jochen> scripts for socket clients but they all do it about the
    Jochen> same.

    Jochen> Is there another way for collecting the data sent to a
    Jochen> socket or to learn about the stop of a connection that
    Jochen> might help?

    Jochen> This is how I am doing it now (taken from one of the demos
    Jochen> and/or the library reference from Guido.

    Jochen> Is this general the way python does this or is it Mac
    Jochen> specific?

    Jochen> print 'Response:' while 1: data = sock.recv(1024) print
    Jochen> data if not data: break sock.close()

    Jochen> Jochen

    Jochen> _______________________________________________ Tutor
    Jochen> maillist - Tutor@python.org
    Jochen> http://www.python.org/mailman/listinfo/tutor