Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
339c8d06
Commit
339c8d06
authored
Jan 13, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
socket: add inet_XtoY functions
parent
53ff5713
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
gevent/socket.py
gevent/socket.py
+23
-0
No files found.
gevent/socket.py
View file @
339c8d06
...
...
@@ -38,6 +38,10 @@ __all__ = ['create_connection',
'gaierror'
,
'getaddrinfo'
,
'gethostbyname'
,
'inet_aton'
,
'inet_ntoa'
,
'inet_pton'
,
'inet_ntop'
,
'socket'
,
'socketpair'
,
'timeout'
,
...
...
@@ -72,6 +76,25 @@ for name in __socket__.__all__:
del
name
,
value
inet_ntoa
=
_socket
.
inet_ntoa
inet_aton
=
_socket
.
inet_aton
try
:
inet_ntop
=
_socket
.
inet_ntop
except
AttributeError
:
def
inet_ntop
(
address_family
,
packed_ip
):
if
address_family
==
AF_INET
:
return
inet_ntoa
(
packed_ip
)
# XXX: ipv6 won't work on windows
raise
NotImplementedError
(
'inet_ntop() is not available on this platform'
)
try
:
inet_pton
=
_socket
.
inet_pton
except
AttributeError
:
def
inet_pton
(
address_family
,
ip_string
):
if
address_family
==
AF_INET
:
return
inet_aton
(
ip_string
)
# XXX: ipv6 won't work on windows
raise
NotImplementedError
(
'inet_ntop() is not available on this platform'
)
# XXX: import other non-blocking stuff, like ntohl
# XXX: implement blocking functions that are not yet implemented
# XXX: add test that checks that socket.__all__ matches gevent.socket.__all__ on all supported platforms
...
...
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