Joachim Roop wrote:
Even though my non-python telnet-server on the other side is sending #00-bytes, 
they are not recognized by python's telnetlib (characters #01-#FF seem to work 
fine though).
My C++ implementation has no problems with this.  I have to use Python 3.1 on 
Windows.

I'm guessing this a known bug. What is the workaround? :(

Don't guess, search.

http://bugs.python.org/


# Receiver
tn = telnetlib.Telnet()
tn.open(ip, port)

while 1:
  response = (tn.read_until(b"\r",20))[1:-1]

Is there a reason that you throw away the first and last byte being read? My wild guess is that the NULL is either the first byte, or most likely the last, and then you throw it away.


  if response.find(bytes.fromhex("00")) > -1:

It might be simpler to use a byte literal instead of calling a function to generate a NULL.

    if response.find(b'\x00') > -1:


    print ("There are hex00 characters")
  else:
    print ("No hex00 characters found")

tn.close


Hope this helps.



--
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to