Commit a461b5ef authored by 's avatar

merged 1.6/2.0 compat fix

parent a7a58b1c
......@@ -332,7 +332,7 @@ class Server:
if verbose:
print "set of REUSEADDR failed", sys.exc_type, sys.exc_value
pass
sock.bind(self.HOST, self.port)
sock.bind((self.HOST, self.port))
sock.listen(self.BACKLOG)
self.socket = sock
return sock
......
......@@ -9,12 +9,12 @@ PORT = 7739
def spew(msg, host='localhost', port=PORT):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind('', 0)
s.bind(('', 0))
s.sendto(msg, (host, port))
def bucket(port=PORT, logfile=None):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind('', port)
s.bind(('', port))
print 'creosote bucket waiting on port: %s' % port
if logfile:
f = open(logfile, 'a+')
......@@ -41,10 +41,10 @@ class MrCreosote:
return
if self.redirect_server == None:
self.redirect_server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.redirect_server.bind('', self.port)
self.redirect_server.bind(('', self.port))
if self.redirect_client == None:
self.redirect_client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.redirect_client.bind('', 0)
self.redirect_client.bind(('', 0))
while 1:
data, addr = self.redirect_server.recvfrom(BUFSIZE)
self.redirect_client.sendto(data, (host, port))
......@@ -53,7 +53,7 @@ class MrCreosote:
return
if self.client == None:
self.client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.client.bind('', 0)
self.client.bind(('', 0))
self.client.sendto(msg, (self.host, self.port))
if __name__ == '__main__':
......
......@@ -192,7 +192,7 @@ class PCGIPublisher:
self.hostname = socket.gethostname()
try:
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.bind(self.hostname, self.port)
self.sock.bind((self.hostname, self.port))
except socket.error:
return self.fatalError("error binding to socket: %s" % self.socketFile)
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment