Socket Connection Read Data as Byte Array

I’m trying to create a socket connection and read the buffer as an array of bytes. The socket connection works fine. So performering a simple socket.recv (returns a string) works fine, however, when I perform a socket.recv_into (reads buffer as array of bytes) it doesn’t work. The error seems to indicate that socket.recv_into isn’t included in the library. Any advice would be appreciated.

import socket
IP = ‘localhost’
Port = 4103
buff = 100
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((IP,Port))
#nbytes = s.recv_into(data) [color=#0000FF]#This doesnt work[/color]
data = s.recv(buff) [color=#0000FF] #This WORKS![/color]
s.close()

print nbytes

Despite Python’s more current documentation claiming recv_into is ‘New in version 2.5’, I think it’s actually new in 2.6. If you look at the old 2.5 documentation there is no recv_into.

docs.python.org/release/2.5/lib … jects.html

Are there plans to update the Python library to a more current version? Timeline?

Until recently there hasn’t even been a new version to update to, but it looks like Jython 2.7 is nearing a release, so maybe we can update to that in the future.

It’s not scheduled at all right now, so in all likelihood the earliest you’d see it would be something like Ignition 7.9.

(the Jython project lags significantly behind Python: jython.org)