[IronPython] socket for IronPython update

Sanghyeon Seo sanxiyn at gmail.com
Mon Sep 11 12:08:45 CEST 2006

I updated my socket module for IronPython. Although standard
IronPython release already has a socket module, it doesn't support
makefile(), ssl(), and select.select() yet, so this module is still


Changes are mostly following socket.cs.
* Renamed SocketType class to PythonSocket, as previous name shadowed
* Use Enum.ToObject() to convert integer constants, instead of if/else

As IronPython already includes socket.py, you need to a way to
override built-in modules to use my module. I updated my site.py with
appropriate code.


Relevant part is:

import imp
import sys
import os

def override_builtin(name):
    sys.modules[name] = module = imp.new_module(name)
    path = os.path.join(sys.prefix, 'Lib', name + '.py')
    execfile(path, module.__dict__)


Seo Sanghyeon

More information about the Ironpython-users mailing list