En Tue, 05 Jun 2007 14:22:48 -0300, Todd Hopfinger <[EMAIL PROTECTED]> escribió:
> I am using TLS Lite and J2ME SecureConnection for the purposes of > encrypting > 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 > ('Too > 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. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list