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
dd918a99
Kaydet (Commit)
dd918a99
authored
Ock 28, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add simple Unix socket example by Piet van Oostrum.
üst
5b8b8cd6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletion
+27
-1
README
Demo/sockets/README
+3
-1
unixclient.py
Demo/sockets/unixclient.py
+10
-0
unixserver.py
Demo/sockets/unixserver.py
+14
-0
No files found.
Demo/sockets/README
Dosyayı görüntüle @
dd918a99
...
...
@@ -5,10 +5,12 @@ echosvr.py About the simplest TCP server possible.
finger.py Client for the 'finger' protocol.
ftp.py A very simple ftp client.
gopher.py A simple gopher client.
radio.py Receive time broadcasts from broadcast.py.
telnet.py Client for the 'telnet' protocol.
throughput.py Client and server to measure TCP throughput.
unixclient.py Unix socket example, client side
unixserver.py Unix socket example, server side
udpecho.py Client and server for the UDP echo protocol.
radio.py Receive time broadcasts from broadcast.py.
The following file is only relevant on SGI machines (or other systems
that support multicast):
...
...
Demo/sockets/unixclient.py
0 → 100644
Dosyayı görüntüle @
dd918a99
# Echo client demo using Unix sockets
# Piet van Oostrum
from
socket
import
*
FILE
=
'blabla'
s
=
socket
(
AF_UNIX
,
SOCK_STREAM
)
s
.
connect
(
FILE
)
s
.
send
(
'Hello, world'
)
data
=
s
.
recv
(
1024
)
s
.
close
()
print
'Received'
,
`data`
Demo/sockets/unixserver.py
0 → 100644
Dosyayı görüntüle @
dd918a99
# Echo server program using Unix sockets (handles one connection only)
from
socket
import
*
FILE
=
'blabla'
s
=
socket
(
AF_UNIX
,
SOCK_STREAM
)
s
.
bind
(
FILE
)
print
'Sock name is: ['
+
s
.
getsockname
()
+
']'
s
.
listen
(
1
)
conn
,
addr
=
s
.
accept
()
print
'Connected by'
,
addr
while
1
:
data
=
conn
.
recv
(
1024
)
if
not
data
:
break
conn
.
send
(
data
)
conn
.
close
()
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