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
3d69c0e4
Kaydet (Commit)
3d69c0e4
authored
May 03, 2000
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Someone found the examples of poor practice on socket addresses!
Spotted by Greg Kochanski <gpk@bell-labs.com>.
üst
25871c00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
libsocket.tex
Doc/lib/libsocket.tex
+3
-3
No files found.
Doc/lib/libsocket.tex
Dosyayı görüntüle @
3d69c0e4
...
@@ -413,7 +413,7 @@ from socket import *
...
@@ -413,7 +413,7 @@ from socket import *
HOST = '' # Symbolic name meaning the local host
HOST = '' # Symbolic name meaning the local host
PORT = 50007 # Arbitrary non-privileged server
PORT = 50007 # Arbitrary non-privileged server
s = socket(AF
_
INET, SOCK
_
STREAM)
s = socket(AF
_
INET, SOCK
_
STREAM)
s.bind(
HOST, PORT
)
s.bind(
(HOST, PORT)
)
s.listen(1)
s.listen(1)
conn, addr = s.accept()
conn, addr = s.accept()
print 'Connected by', addr
print 'Connected by', addr
...
@@ -430,7 +430,7 @@ from socket import *
...
@@ -430,7 +430,7 @@ from socket import *
HOST = 'daring.cwi.nl' # The remote host
HOST = 'daring.cwi.nl' # The remote host
PORT = 50007 # The same port as used by the server
PORT = 50007 # The same port as used by the server
s = socket(AF
_
INET, SOCK
_
STREAM)
s = socket(AF
_
INET, SOCK
_
STREAM)
s.connect(
HOST, PORT
)
s.connect(
(HOST, PORT)
)
s.send('Hello, world')
s.send('Hello, world')
data = s.recv(1024)
data = s.recv(1024)
s.close()
s.close()
...
@@ -438,5 +438,5 @@ print 'Received', `data`
...
@@ -438,5 +438,5 @@ print 'Received', `data`
\end{verbatim}
\end{verbatim}
\begin{seealso}
\begin{seealso}
\seemodule
{
SocketServer
}{
classes that simplify writing network servers
}
\seemodule
{
SocketServer
}{
classes that simplify writing network servers
}
\end{seealso}
\end{seealso}
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