Main Page
Namespaces
Classes
Files
File List
src
rosbridge_server
util.py
Go to the documentation of this file.
1
import
socket
2
3
4
def
get_ephemeral_port
(sock_family=socket.AF_INET, sock_type=socket.SOCK_STREAM):
5
"""Return an ostensibly available ephemeral port number."""
6
# We expect that the operating system is polite enough to not hand out the
7
# same ephemeral port before we can explicitly bind it a second time.
8
s = socket.socket(sock_family, sock_type)
9
s.bind((
''
, 0))
10
port = s.getsockname()[1]
11
s.close()
12
return
port
rosbridge_server.util.get_ephemeral_port
def get_ephemeral_port(sock_family=socket.AF_INET, sock_type=socket.SOCK_STREAM)
Definition:
util.py:4
rosbridge_server
Author(s): Jonathan Mace
autogenerated on Wed Jun 3 2020 03:55:18