Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P484
Get available free port
Active
Public
Actions
Authored by
haltode
on Aug 1 2019, 10:05 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
# Get an available port number
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
sock
.
bind
((
'127.0.0.1'
,
0
))
self
.
port
=
sock
.
getsockname
()[
1
]
sock
.
close
()
Event Timeline
haltode
created this paste.
Aug 1 2019, 10:05 AM
2019-08-01 10:05:40 (UTC+2)
haltode
created this object in space
S1 Public
.
Log In to Comment