freakin out over C++ module in python

Michael Ekstrand michael at elehack.net
Tue Apr 18 08:45:03 EDT 2006


nephish at xit.net wrote:
> i would go thru it line by line, but i just dont know enough about C++,
> how it pulls off a socket connection, etc.. and some of the things i
> dont know how to do in python. like how to make an unsigned long init.

The networking code in C++ should be at least vaguely similar to the
appropriate Python code using the socket module.  Python's socket module
is a fairly thin wrapper around BSD sockets; its method names, etc.
match the socket system calls.  If the C++ is using plain berkely-ish
socket code, you'll find connect(), send(), recv() calls (or something
similar - I don't know what Winsock calls them for sure); these map to
appropriate methods and functions in the socket module.  If the C++ code
is using some C++ sockets wrapper, I don't know; it still would probably
be somewhat similar.  Or similar enough that you can read it.  Unless
they're somehow finagling sockets in to the iostreams library (possible,
but unlikely).

- Michael

-- 
mouse, n: a device for pointing at the xterm in which you want to type.
                -- Fortune
Visit me on the Web: http://www.elehack.net



More information about the Python-list mailing list