Changeset 5068 for pjproject/trunk
- Timestamp:
- Apr 13, 2015 12:31:46 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/tests/pjsua/inc_cfg.py
r2237 r5068 2 2 import random 3 3 import config_site 4 import socket 5 import errno 4 6 5 7 DEFAULT_ECHO = True … … 47 49 # Give random sip_port if it's not specified 48 50 if sip_port==0: 49 self.sip_port = random.randint(DEFAULT_START_SIP_PORT, 65534) 51 # avoid port conflict 52 cnt = 0 53 port = 0 54 while cnt < 10: 55 cnt = cnt + 1 56 port = random.randint(DEFAULT_START_SIP_PORT, 65534) 57 s = socket.socket(socket.AF_INET) 58 try: 59 s.bind(("0.0.0.0", port)) 60 except socket.error as serr: 61 s.close() 62 if serr.errno == errno.EADDRINUSE: 63 continue 64 s.close() 65 break; 66 self.sip_port = port 50 67 else: 51 68 self.sip_port = sip_port
Note: See TracChangeset
for help on using the changeset viewer.