A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-November/040237.html below:

[Python-Dev] Getting socket information from socket objects

[Python-Dev] Getting socket information from socket objectsGuido van Rossum guido at python.org
Fri Nov 14 13:14:01 EST 2003
> It appears that the easiest way to retrieve family/type/protocol
> fields from socket objects is this:

> def getsockinfo(sock):
>     s = `sock._sock`
>     sp = s[1:-1].split(",")[1:]
>     g = {}
>     d = {}
>     for i in sp:
>         exec i.strip() in g, d
>     return (d["family"], d["type"], d["protocol"])

> Wouldn't it be nice to have accessors for these fields? My
> particular use-case is Windows-specific (IO completion port
> proactor), so winsock API provides this, but I'd rather avoid that
> crud.

Sounds like a good idea.  Upload your patches to SF!

> Also, exporting getsockaddrarg in socketmodule.c CAPI would be
> useful, although the only use I can think of is implementing
> Windows' ConnectEx (which I am doing)

I'm unclear on what you propose here; again, a working patch on SF
showing what you propose would help.

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

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4