[Edu-sig] socket-module

Guido van Rossum guido@python.org
Mon, 26 Jun 2000 15:28:49 -0500


> 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)

The lowest level code is imported at the top by the statement "from
_socket import *".  This imports a module written in C.  If you have a
Python source distribution, you can find it at Modules/socketmodule.c.

Source code is also on-line in the CVS tree:
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/python/dist/src/Modules/socketmodule.c?cvsroot=python

--Guido van Rossum (home page: http://www.python.org/~guido/)