jython socket sendall

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark Fink

    #1

    jython socket sendall

    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 establishConnec tion(self):
    self.socket = socket.socket(s ocket.AF_INET, socket.SOCK_STR EAM)
    print type(self.host) , repr(self.host)
    print type(self.port) , repr(self.port)
    self.socket.con nect((self.host , self.port))
    # self.socketOutp ut = self.socket.get OutputStream()
    self.socketOutp ut = self.socket
    # self.socketRead er = StreamReader(se lf.socket.getIn putStream())
    self.socketRead er = self.socket
    bytes = self.makeHttpRe quest().encode( "UTF-8")
    print type(bytes), repr(bytes)
    self.socketOutp ut.sendall(byte s)
    # self.socketOutp ut.flush()
    sys.stdout.writ e("http request sent\n")

    -Mark

  • Mark Fink

    #2
    Re: jython socket sendall

    I used send instead. This should work.
    -Mark

    Comment

    Working...