I’ve written a Jython socket program that grabs incoming messages and writes them to a database. It works great with my test data.

 

But now, I want to send a message that contains mixed data types. During testing, I had the luxury of encoding and decoding on both ends, but in this case I can’t do that. For instance, I might have this list of data:

 

[‘Test’1,’Test2,100,7,18,’21’]

 

What I want to do is concatenate each item in the list into a string for the socket.send. Note that this needs to be a raw stream of bytes, so converting 100 to a string isn’t possible. Obviously I can’t just use a ‘’.join due to the non-string variables, so I looked at the java libraries and it looks like some combination of jarray, java.lang.string, and outputstream should work. Can someone point me in the right direction?

 

Thanks.

 

Carl