/usr/lib/python2.7/dist-packages/pyarco/Net.py is in atheist 0.20110402-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # -*- mode: python; coding: utf-8 -*-
"""net module provides functions for network programming
.. moduleauthor:: Arco Research Group
"""
import socket
def getFreePort(host=""):
"""Get a free port.
:param host: The hostname.
:type host: str.
:returns: int -- the free port.
"""
s = socket.socket()
s.bind((host, 0))
port = s.getsockname()[1]
s.close()
return port
|