jython socket sendall

M

Mark Fink

Hi there,
I am about to port a server application from Java to Jython. For the
socket part I found some examples written in Python. I have problems to
figure out the socket part of the application. In Jython 2.1 the
sendall function is missing?

def establishConnection(self):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print type(self.host), repr(self.host)
print type(self.port), repr(self.port)
self.socket.connect((self.host, self.port))
# self.socketOutput = self.socket.getOutputStream()
self.socketOutput = self.socket
# self.socketReader = StreamReader(self.socket.getInputStream())
self.socketReader = self.socket
bytes = self.makeHttpRequest().encode("UTF-8")
print type(bytes), repr(bytes)
self.socketOutput.sendall(bytes)
# self.socketOutput.flush()
sys.stdout.write("http request sent\n")

-Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top