[pyOpenSSL] OpenSSL.SSL.ZeroReturnError

Ajay abra9823 at mail.usyd.edu.au
Mon Oct 4 03:28:16 CEST 2004


hi!

i have a client and server that communicate over an SSL connection. the
client connects to the server and sends some data and then closes. For
some reason, on the server side, every time i try to read data, i ger a
ZeroReturnError.

my client code is
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn = SSL.Connection(ctx, s)
conn.connect((host, port))
conn.send(result)
conn.shutdown()
conn.close()

the server is

addr = (SERVICE_HOST, SERVICE_PORT)
globals()['serverconn'] = Connection(context, socket.socket(socket.AF_INET,
socket.SOCK_STREAM))
globals()['serverconn'].bind(addr)
print "server started"
globals()['serverconn'].listen(5)
while 1:
	(cli, address) = globals()['serverconn'].accept()
	print 'Connection from %s' % (addr,)
	#try:
	str = cli.recv(1024)
	data=""
	while len(str) != 0:
		data += str
		str = cli.recv(1024)
	print "received " #, data

the error comes at "str = cli.recv(1024)"
i get to the 'the connection from...' print statement, and then the error
comes up.

What am i doing wrong? And how can i get rid of the error?
the same code worked fine before i added the SSL part, so i doubt there is
anything fundamentally wrong with the code.

thanks

cheers

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the pyopenssl-users mailing list