socket-module
Thomas Wouters
thomas at xs4all.nl
Mon Jun 26 16:06:54 EDT 2000
On Mon, 26 Jun 2000 18:27:06 +0200, A[r]TA <arta at NOSPAMx-stream.nl> wrote:
>I'm having a question. Maybe a strange one, but don't blame me. Just
>a newbie or something like that :-)
>If you're looking at the source from SOCKET.PY, you see a
>two classes. One for the socket-object and one for the file-descriptor.
>But, this module (in Windows) doesn't import anything.
>And par example:
>def accept(self):
> sock, addr = self._sock.accept()
> return _socketobject(sock), addr
>This is the accept method. Where can I see the lowest-level-Python-code?
>I can't see the real code from HOW it's accepting the connection.
>Is this possible and how? It's basically for me to see the TCP/IP-packages
>Python is creating....(very low level)
I believe socket.py is only used for operating systems that have a slightly
different way of doing networking, like Windows and BeOS. If you look at the
top of socket.py, you'll see something like this:
try:
from _socket import *
except ImportError:
from socket import *
_realsocketcall = socket
Meaning that the real low-level API is pulled from either the _socket or the
socket module, which is likely a loadable library (a DLL, under windows) or
compiled-in module.
If you want to see the real gory details about the socket library, you'll
have to delve into the C source ;-P I think the socketmodule for Windows is
the normal socketmodule, with slightly different #defines. You can find
socketmodule.c in the Modules subdirectory of the source tree.
Good-luck-ly y'rs,
Thomas.
More information about the Python-list
mailing list