[PEAK] tools.server.url

Wayne Larsen wayne at larsen.st
Sun Oct 17 17:28:56 EDT 2004


Hi Phillip,

Regarding the peak.tools.server.url that you were discussing with Ian 
on web-sig:  On OSX, the default (':0' in the url) gives the following 
exception.  I need to set that to a fixed port for it to work:

   File "/Users/waynelarsen/Development/PEAK/src/peak/net/sockets.py", 
line 197, in <lambda>
     lambda o: o.listen_sockets(maxsocks=1)[0],
   File "/Users/waynelarsen/Development/PEAK/src/peak/net/sockets.py", 
line 68, in listen_sockets
     raise socket.error, msg
socket.error: (43, 'Protocol not supported')


With a fixed port, I run into the following exception all the time:

   File "/Users/waynelarsen/Development/PEAK/src/peak/net/sockets.py", 
line 196, in <lambda>
     lambda o: o.listen_sockets(maxsocks=1)[0],
   File "/Users/waynelarsen/Development/PEAK/src/peak/net/sockets.py", 
line 67, in listen_sockets
     raise socket.error, msg
socket.error: (48, 'Address already in use')	

The following patch prevents that from being an issue:

--- sockets.py  5 Jul 2004 23:41:50 -0000       1.14
+++ sockets.py  17 Oct 2004 21:27:51 -0000
@@ -55,6 +55,7 @@
                      except OSError,v:
                          if v<>errno.ENOENT: # ignore if socket doesn't 
exist
                              raise
+                s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
                  s.bind(sa)
                  s.listen(5) # should will be made configurable
                  sockets.append(s)


Cheers,
Wayne




More information about the PEAK mailing list