[Tutor] Network programming

Johan Geldenhuys johan at accesstel.co.za
Mon Sep 20 14:48:46 CEST 2004


I am using 2.3.4.

It is for sure in the data stream and not outside the 8192 boundary. It
is characters that I send myslef to the port and nothing happens. I can
see that the other end gets it.

Johan
On Mon, 2004-09-20 at 14:31, Kent Johnson wrote:

> Are you using Python 2.3? Prior to 2.3, 'x in y' would throw a TypeError if 
> y is a string and x is a string longer than one character.
> 
> Is it working sometimes but missing sometimes? If the brsq spans an 
> 8192-byte boundary you will miss it.
> 
> Are you sure the brsq is in the data sent? Maybe it has just a newline 
> terminator, or a space after the \x71 or some other difference from what 
> you are expecting.
> 
> Kent
> 
> At 12:41 PM 9/20/2004 +0200, you wrote:
> >Hi all ye good people,
> >I have a incomming data stream on a socket and are forwarding all the data 
> >to a client connection.
> >
> >I want to look for a certain data sequence in the incomming data and if 
> >that is received, the socket connection must be closed. In the following 
> >code, newdata is received from a socket server and send out to a client 
> >connection self.sock(). Now if 'brsq' is in the data received, the 
> >connection 'conn' must be closed. Or the preceeding while loop must be 
> >broken. At this stage the 'brsq' is not recognised.
> >
> >Any suggestions?
> >
> >Thanks
> >Johan
> >
> >if conn in inFds:
> >           newdata = conn.recv(8192)
> >       self.log('Newdata recveived in line 129:' + `newdata`)
> >         self.sock.send(newdata)
> >
> >       brsq = '\x71\x0D\0A'
> >
> >       if brsq in newdata:
> >           self.log('Break signal received on line 134' + `newdata`)
> >           break
> >
> >           else:
> >            continue
> >
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
       Johan Geldenhuys
Access Telecommunication Systems
 Mail to: johan at accesstel.co.za

-- 
This message has been scanned for viruses and
dangerous content by Azitech, and is
believed to be clean.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040920/23473ab4/attachment.html


More information about the Tutor mailing list