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
edd6376e
Kaydet (Commit)
edd6376e
authored
Eyl 01, 1995
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
added read/writelines, bufsize to makefile, gethostbyaddr
üst
b9e39c88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
7 deletions
+29
-7
socket.py
Mac/Unsupported/mactcp/socket.py
+29
-7
No files found.
Mac/Unsupported/mactcp/socket.py
Dosyayı görüntüle @
edd6376e
...
...
@@ -54,6 +54,15 @@ def gethostbyname(str):
return
macdnr
.
AddrToStr
(
id
)
def
gethostbyaddr
(
str
):
id
=
_ipaddress
(
str
)
ptr
=
macdnr
.
AddrToName
(
id
)
ptr
.
wait
()
name
=
ptr
.
cname
if
name
[
-
1
:]
==
'.'
:
name
=
name
[:
-
1
]
names
,
addresses
=
[],
[
str
]
return
name
,
names
,
addresses
def
gethostname
():
global
_myname
if
_myname
==
None
:
...
...
@@ -164,8 +173,8 @@ class _tcpsocket(_socket):
self
.
stream
.
PassiveOpen
(
self
.
port
)
self
.
listening
=
1
def
makefile
(
self
,
rw
=
'r'
):
return
_socketfile
(
self
,
rw
)
def
makefile
(
self
,
rw
=
'r'
,
bs
=
512
):
return
_socketfile
(
self
,
rw
,
bs
)
def
recv
(
self
,
bufsize
,
flags
=
0
):
if
flags
:
...
...
@@ -206,14 +215,15 @@ class _udpsocket(_socket):
class
_socketfile
:
def
__init__
(
self
,
sock
,
rw
):
def
__init__
(
self
,
sock
,
rw
,
bs
):
if
rw
not
in
(
'r'
,
'w'
):
raise
_myerror
,
"mode must be 'r' or 'w'"
self
.
sock
=
sock
self
.
rw
=
rw
self
.
bs
=
bs
self
.
buf
=
''
def
read
(
self
,
length
=
0
):
if
length
<
=
0
:
def
read
(
self
,
length
=
-
1
):
if
length
<
0
:
length
=
0x7fffffff
while
len
(
self
.
buf
)
<
length
:
new
=
self
.
sock
.
recv
(
0x7fffffff
)
...
...
@@ -240,8 +250,16 @@ class _socketfile:
self
.
buf
=
self
.
buf
[
i
+
1
:]
return
rv
def
readlines
(
self
):
list
=
[]
line
=
self
.
readline
()
while
line
:
list
.
append
(
line
)
line
=
self
.
readline
()
return
list
def
write
(
self
,
buf
):
BS
=
512
BS
=
self
.
bs
if
len
(
buf
)
>=
BS
:
self
.
flush
()
self
.
sock
.
send
(
buf
)
...
...
@@ -250,7 +268,11 @@ class _socketfile:
self
.
buf
=
buf
else
:
self
.
buf
=
self
.
buf
+
buf
def
writelines
(
self
,
list
):
for
line
in
list
:
self
.
write
(
line
)
def
flush
(
self
):
if
self
.
buf
and
self
.
rw
==
'w'
:
self
.
sock
.
send
(
self
.
buf
)
...
...
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