예제 #1
0
 def bindsocket(self):
     try:
         uid = os.getuid()
     except AttributeError:
         uid = 1
     if uid == 0:
         port = rpc.bindresvport(self.sock, '')
         # 'port' is not used
     else:
         self.sock.bind(('', 0))
예제 #2
0
 def bindsocket(self):
     import os
     try:
         uid = os.getuid()
     except AttributeError:
         uid = 1
     if uid == 0:
         port = rpc.bindresvport(self.sock, '')
         # 'port' is not used
     else:
         self.sock.bind(('', 0))