gagsl-py2 at yahoo.com.ar
Thu Jun 7 20:21:19 CEST 2007
En Tue, 05 Jun 2007 14:22:48 -0300, Todd Hopfinger <thopfin at umich.edu>
> I am using TLS Lite and J2ME SecureConnection for the purposes of
> traffic to/from a Java Midlet client and a multithreaded Python server.
> However, I encounter a TLSAbruptCloseError. I have tried to determine the
> cause of the exception to no avail. I understand that it has to do with
> close_notify alerts. My abbreviated code follows.
> // Server
> def sslSockRecv(conn, num):
> data = ''
> while len(data) < num:
> data = conn.recv(num - len(data)) #
> TLSAbruptCloseError thrown here
> if len(data) == 0:
> raise NotEnoughBytes
> few bytes from client. Expected ' + str(num) + '; got ' + str(len(data)),
> num, len(data))
> return data
Without much analysis, shouldn't be: data += conn.recv(num - len(data)) or
something like that?
Else you are discarding the previously received data.
More information about the Python-list