[IronPython] socket for IronPython update

Sylvain Hellegouarch sh at defuze.org
Mon Sep 11 12:10:16 CEST 2006


Thanks a lot Seo.

Any reason that I would have missed why the built-in socket module does
not include those missing module functions?

Thanks,
- Sylvain

> 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
> _______________________________________________
> users mailing list
> users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>




More information about the Ironpython-users mailing list