()
| 13 | |
| 14 | |
| 15 | def get_open_port(): |
| 16 | with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: |
| 17 | s.bind(('', 0)) # bind to all interfaces and use an OS provided port |
| 18 | return s.getsockname()[1] # return only the port number |
| 19 | |
| 20 | |
| 21 | def get_remote_file(remote_path, local_path=None): |