[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
useful.
http://sparcs.kaist.ac.kr/~tinuviel/fepy/lib/socket.py
Changes are mostly following socket.cs.
* Renamed SocketType class to PythonSocket, as previous name shadowed
System.Net.Sockets.SocketType.
* Use Enum.ToObject() to convert integer constants, instead of if/else
statements.
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.
http://sparcs.kaist.ac.kr/~tinuviel/fepy/lib/site.py
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__)
override_builtin('socket')
--
Seo Sanghyeon
More information about the Ironpython-users
mailing list