Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
ccc87b53
Kaydet (Commit)
ccc87b53
authored
May 10, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #12054: use support.find_unused_port() instead of reinventing the wheel
üst
1be815aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
16 deletions
+2
-16
test_socket.py
Lib/test/test_socket.py
+2
-16
No files found.
Lib/test/test_socket.py
Dosyayı görüntüle @
ccc87b53
...
...
@@ -564,23 +564,9 @@ class GeneralModuleTests(unittest.TestCase):
# XXX The following don't test module-level functionality...
def
_get_unused_port
(
self
,
bind_address
=
'0.0.0.0'
):
"""Use a temporary socket to elicit an unused ephemeral port.
Args:
bind_address: Hostname or IP address to search for a port on.
Returns: A most likely to be unused port.
"""
tempsock
=
socket
.
socket
()
tempsock
.
bind
((
bind_address
,
0
))
host
,
port
=
tempsock
.
getsockname
()
tempsock
.
close
()
return
port
def
testSockName
(
self
):
# Testing getsockname()
port
=
s
elf
.
_get
_unused_port
()
port
=
s
upport
.
find
_unused_port
()
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
addCleanup
(
sock
.
close
)
sock
.
bind
((
"0.0.0.0"
,
port
))
...
...
@@ -629,7 +615,7 @@ class GeneralModuleTests(unittest.TestCase):
def
test_getsockaddrarg
(
self
):
host
=
'0.0.0.0'
port
=
s
elf
.
_get_unused_port
(
bind_address
=
host
)
port
=
s
upport
.
find_unused_port
(
)
big_port
=
port
+
65536
neg_port
=
port
-
65536
sock
=
socket
.
socket
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment