Issue1754240

classification
Title: Error Message when attempting to bind to an in use Port
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: pjenvey, rluse
Priority: normal Keywords:

Created on 2007-07-15.08:37:00 by rluse, last changed 2008-10-30.04:23:01 by pjenvey.

Messages
msg1719 (view) Author: Bob Luse (rluse) Date: 2007-07-15.08:37:00
When attempting to bind to an in use port, the error message is Permission Denied, which I think is misleading.  I would recommend that Jython use the same Message the Python uses "Port already in use".

You can create the problem by running the following simple script twice:


import select
import socket
import sys

host = ''
port = 50000
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((host,port))
server.listen(5)
server.setblocking(False)
input = [server]


running = True
while running:
    inputready,outputready,exceptready = \ select.select(input,[],[])
    
    time.sleep(0.01)

The second time you run it, it will say permission denied.
msg3724 (view) Author: Philip Jenvey (pjenvey) Date: 2008-10-30.04:23:00
On trunk (2.5), the errors are now the same. errno differs but that will 
be fixed eventually, too:

CPython 2.5:
Traceback (most recent call last):
  File "/tmp/z.py", line 8, in <module>
    server.bind((host,port))
  File "<string>", line 1, in bind
socket.error: (48, 'Address already in use')

Jython 2.5:
Traceback (most recent call last):
  File "/tmp/z.py", line 9, in <module>
    server.listen(5)
  File "<string>", line 1, in listen
  File "/Users/pjenvey/src/java/jython-trunk-clean2/dist/Lib/socket.py", 
line 741, in listen
    raise _map_exception(jlx)
socket.error: (98, 'Address already in use')
History
Date User Action Args
2008-10-30 04:23:01pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg3724
nosy: + pjenvey
2007-07-15 08:37:00rlusecreate