[pypy-svn] r26174 - pypy/dist/pypy/rpython/rctypes/socketmodule
ac at codespeak.net
ac at codespeak.net
Sun Apr 23 11:54:55 CEST 2006
Author: ac
Date: Sun Apr 23 11:54:55 2006
New Revision: 26174
Modified:
pypy/dist/pypy/rpython/rctypes/socketmodule/_socket.py
pypy/dist/pypy/rpython/rctypes/socketmodule/ctypes_socket.py
Log:
(arre, sanxiyn)
Fix endianness problem.
Modified: pypy/dist/pypy/rpython/rctypes/socketmodule/_socket.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/socketmodule/_socket.py (original)
+++ pypy/dist/pypy/rpython/rctypes/socketmodule/_socket.py Sun Apr 23 11:54:55 2006
@@ -10,7 +10,7 @@
def _ip_to_number(ip):
p1, p2, p3, p4 = [ int(part) for part in ip.split('.') ]
- num = ((p4 * 256 + p3) * 256 + p2) * 256 + p1
+ num = ((p1 * 256 + p2) * 256 + p3) * 256 + p4
return num
@@ -44,10 +44,11 @@
if self.family == AF_INET:
(host, port) = addr
ip = host # XXX
+ num = _ip_to_number(ip)
caddr = _c.sockaddr_in()
caddr.sin_family = AF_INET
caddr.sin_port = _c.htons(port)
- caddr.sin_addr.s_addr = _ip_to_number(ip)
+ caddr.sin_addr.s_addr = _c.htonl(num)
return caddr
else:
raise NotImplementedError('sorry') # XXX
Modified: pypy/dist/pypy/rpython/rctypes/socketmodule/ctypes_socket.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/socketmodule/ctypes_socket.py (original)
+++ pypy/dist/pypy/rpython/rctypes/socketmodule/ctypes_socket.py Sun Apr 23 11:54:55 2006
@@ -60,10 +60,6 @@
errno = c_int.in_dll(socketdll, 'errno')
-htons = socketdll.htons
-htons.argtypes = [uint16_t]
-htons.restype = uint16_t
-
socket = socketdll.socket
socket.argtypes = [c_int, c_int, c_int]
socket.restype = c_int
More information about the Pypy-commit
mailing list