Issue1348645
Created on 2005-11-04.21:15:48 by anonymous, last changed 2007-05-18.19:10:56 by amak.
| Messages | |||
|---|---|---|---|
| msg1073 (view) | Author: Nobody/Anonymous (nobody) | Date: 2005-11-04.21:15:48 | |
With Jython 2.1, I tried to run the send() method from
socket.py and got the error :
File "C:\jython\Lib\socket.py", line 304, in send
TypeError: sendto() takes at least 3 arguments (2 given)
Here is the method in socket.py with the problem shown
in the stacktrace:
def send(self, data):
assert self.addr
return self.sendto(self.addr) # line 304
The definition of self.sendto() is:
def sendto(self, data, addr):
n = len(data)
if not self.sock:
self.sock = java.net.DatagramSocket()
host, port = addr
bytes = jarray.array(map(ord, data), 'b')
a = java.net.InetAddress.getByName(host)
packet = java.net.DatagramPacket(bytes, n, a, port)
self.sock.send(packet)
return n
It looks like there is a missing argument in the call
to self.sendto() that is in send(). If I edit send():
return self.sendto(data, self.addr) # line 304
it seems to fix the problem.
|
|||
| msg1074 (view) | Author: Frank Wierzbicki (fwierzbicki) | Date: 2005-11-05.15:11:43 | |
Logged In: YES user_id=193969 Alan Kennedy is working on some updates to sockets from jython -- so hopefully this will get cleaned up in the 2.2 series. |
|||
| msg1075 (view) | Author: Alan Kennedy (amak) | Date: 2007-05-18.19:10:56 | |
This was indeed a bug; the send function could never have worked as it was.
This is already fixed in 2.2b2.
As for jython 2.1, the simple fix suggested above will work, i.e. change the send function to be defined as
def send(self, data):
assert self.addr
return self.sendto(data, self.addr)
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2005-11-04 21:15:48 | anonymous | create | |
Supported by Python Software Foundation,
Powered by Roundup