summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Patch 731209: Restore socketmodule's behaviour with dotted quad addressesAnthony Baxter2003-05-021-0/+16
| | | | | to that of Python2.1. Such nnn.nnn.nnn.nnn addresses are just used directly, not passed to the resolver for a pointless lookup.
* Patch #725942: Always rename emulation functions.Martin v. Löwis2003-05-011-2/+5
|
* Patch by Jp Calderone:Guido van Rossum2003-04-251-1/+114
| | | | | | | | | - The socket module now provides the functions inet_pton and inet_ntop for converting between string and packed representation of IP addresses. See SF patch #658327. This still needs a bit of work in the doc area, because it is not available on all platforms (especially not on Windows).
* Implement IDNA (Internationalized Domain Names in Applications).Martin v. Löwis2003-04-181-5/+25
|
* Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.Martin v. Löwis2003-03-291-1/+1
|
* The connect timeout code wasn't working on Windows.Guido van Rossum2003-02-191-12/+13
| | | | | | Rather than trying to second-guess the various error returns of a second connect(), use select() to determine whether the socket becomes writable (which means connected).
* socket_inet_aton(): ip_addr was left undefined before use in theTim Peters2003-02-131-9/+9
| | | | | !HAVE_INET_ATON case. Repaired that, and tried to repair what looked like out-of-date comments.
* Ummm, try to get it right this timeNeal Norwitz2003-02-131-1/+1
|
* Use configure to check for inet_aton.Neal Norwitz2003-02-131-1/+1
|
* Addressing SF bug #643005, implement socket.inet_aton() usingGuido van Rossum2003-02-121-1/+17
| | | | | | | | | inet_aton() rather than inet_addr() -- the latter is obsolete because it has a problem: "255.255.255.255" is a valid address but indistinguishable from an error. (I'm not sure if inet_aton() exists everywhere -- in case it doesn't, I've left the old code in with an #ifdef.)
* SF patch #678257 by Geoff Talvola.Guido van Rossum2003-01-311-1/+1
| | | | | In sendall(), do an internal select before each send() call, instead of only for the first one.
* Patch #661760: Cygwin auto-import module patchJason Tishler2003-01-061-6/+3
| | | | | | | | | | | | The attached patch enables shared extension modules to build cleanly under Cygwin without moving the static initialization of certain function pointers (i.e., ones exported from the Python DLL core) to a module initialization function. Additionally, this patch fixes the modules that have been changed in the past to accommodate Cygwin.
* OS/2 sockets do not support AF_UNIX, even though EMX headers define itAndrew MacIntyre2003-01-021-4/+4
|
* Patch #650422: Use Posix AF_ constants instead of PF_ ones.Martin v. Löwis2002-12-111-5/+7
|
* Don't include <ioctl.h> unless on __VMS.Martin v. Löwis2002-12-061-1/+3
|
* Patch #614055: Support OpenVMS.Martin v. Löwis2002-12-061-1/+106
|
* Use O_NONBLOCK rather than O_NDELAY, so we get POSIX non-blocking I/O.Neal Norwitz2002-11-021-4/+4
| | | | | | | | | | | | | On HPUX, Solaris, Tru64 (Dec UNIX), and IRIX (I think), O_NONBLOCK is the POSIX version of non-blocking I/O which is what we want. On Linux and FreeBSD (at least), O_NONBLOCK and O_NDELAY are the same. So this change should have no negative effect on those platforms. Tested on Linux, Solaris, HPUX. Thanks to Anders Qvist for diagnosing this problem.
* Patch #608999: Fix portability problems with MIPSPro 7.xMartin v. Löwis2002-09-191-0/+8
|
* Update the module doc comment.Guido van Rossum2002-09-031-1/+3
|
* SF bug #592645 fix memory leak in socket.getaddrinfoNeal Norwitz2002-08-091-0/+2
|
* The other half of the patches added to SF patch 555085 by A IGuido van Rossum2002-08-081-0/+2
| | | | | | MacIntyre. At least on OS/2, a subsequent connect() on a nonblocking socket returns errno==EISCONN to indicate success. This seems harmless on Unix.
* Clean up some docstrings. Some docstrings didn't show their returnGuido van Rossum2002-08-081-10/+11
| | | | | | value; others were inconsistent in what to name the argument or return value; a few module-global functions had "socket." in front of their name, against convention.
* internal_connect(): Windows. When sock_timeout > 0 and connect() yieldsTim Peters2002-08-061-6/+14
| | | | | | | WSAEWOULDBLOCK, the second connect() attempt appears to yield WSAEISCONN on Win98 but WSAEINVAL on Win2K. So accept either as meaning "yawn, fine". This allows test_socket to succeed on my Win2K box (which it already did on my Win98SE box).
* Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototypeMark Hammond2002-08-021-1/+1
| | | | | | for Py_Main(). Thanks to Kalle Svensson and Skip Montanaro for the patches.
* Pass length of result structure into setipaddr. Fixes bug #565747.Martin v. Löwis2002-07-281-8/+12
| | | | Committed to 2.2 branch.
* Put checks for error returns in the right place.Jeremy Hylton2002-07-251-2/+8
|
* Extended socket.htonl and ntohl to accept longs.Jeremy Hylton2002-07-251-15/+53
| | | | | | | Fixes SF bug #568322. The code should raise an OverflowError if the long is > 32 bits, even on platforms where sizeof(long) > 4.
* Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." linkMark Hammond2002-07-231-1/+1
| | | | | command line for Windows builds. This should allow MSVC to import and build the Python MSVC6 project files without error.
* Bail out early from internal_select() when socket file descriptorGuido van Rossum2002-07-191-0/+5
| | | | closed. Prevents core dump.
* A Python float is a C double; redeclare defaulttimeout as such; stopsTim Peters2002-07-181-1/+1
| | | | compiler wngs on Windows.
* Silence warning about getdefaulttimeout in PyMethodDef.Guido van Rossum2002-07-181-1/+1
|
* Add default timeout functionality. This adds setdefaulttimeout() andGuido van Rossum2002-07-181-1/+65
| | | | | getdefaulttimeout() functions to the socket and _socket modules, and appropriate tests.
* staticforward bites the dust.Jeremy Hylton2002-07-171-1/+1
| | | | | | | | | | | | | | | The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation.
* Mac OS X Jaguar (developer preview) seems to have a working getaddrinfo().Jack Jansen2002-07-021-0/+5
|
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-82/+82
|
* Fix non-blocking connect() for Windows. Refactored the codeGuido van Rossum2002-06-131-27/+40
| | | | | | | | | | | that retries the connect() call in timeout mode so it can be shared between connect() and connect_ex(), and needs only a single #ifdef. The test for this was doing funky stuff I don't approve of, so I removed it in favor of a simpler test. This allowed me to implement a simpler, "purer" form of the timeout retry code. Hopefully that's enough (if you want to be fancy, use non-blocking mode and decode the errors yourself, like before).
* Major overhaul of timeout sockets:Guido van Rossum2002-06-131-219/+58
| | | | | | | | | | | | | | | | | | | | - setblocking(0) and settimeout(0) are now equivalent, and ditto for setblocking(1) and settimeout(None). - Don't raise an exception from internal_select(); let the final call report the error (this means you will get an EAGAIN error instead of an ETIMEDOUT error -- I don't care). - Move the select to inside the Py_{BEGIN,END}_ALLOW_THREADS brackets, so other theads can run (this was a bug in the original code). - Redid the retry logic in connect() and connect_ex() to avoid masking errors. This probably doesn't work for Windows yet; I'll fix that next. It may also fail on other platforms, depending on what retrying a connect does; I need help with this. - Get rid of the retry logic in accept(). I don't think it was needed at all. But I may be wrong.
* work around name clash with OS/2 TCPIP routine sock_init()Andrew MacIntyre2002-06-131-2/+2
|
* Move the conex_finally label up, so that the errno value is alwaysGuido van Rossum2002-06-071-1/+1
| | | | returned.
* I decided to change the interaction between setblocking() andGuido van Rossum2002-06-071-5/+2
| | | | | | | | | | settimeout(). Already, settimeout() canceled non-blocking mode; now, setblocking() also cancels the timeout. This is easier to document. (XXX should settimeout(0) be an alias for setblocking(0)? They seem to have roughly the same effect. Also, I'm not sure that the code in connect() and accept() is correct in all cases. We'll sort this out soon enough.)
* Major cleanup. Renamed static methods to avoid Py prefix. Other miscGuido van Rossum2002-06-071-296/+290
| | | | cleanup as well, e.g. renamed NTinit to os_init.
* Whitespace normalization, folding long lines, uniform commentGuido van Rossum2002-06-071-224/+229
| | | | delimiters. Also repaired some docstrings and comments.
* Correct several blunders in the timeout code, mostly my own fault (forGuido van Rossum2002-06-071-14/+12
| | | | | | | | | | | | | | | | | | | | | not testing it -- apparently test_timeout.py doesn't test anything useful): In internal_select(): - The tv_usec part of the timeout for select() was calculated wrong. - The first argument to select() was one too low. - The sense of the direction argument to internal_select() was inverted. In PySocketSock_settimeout(): - The calls to internal_setblocking() were swapped. Also, repaired some comments and fixed the test for the return value of internal_select() in sendall -- this was in the original patch.
* SF patch 555085 (timeout socket implementation) by Michael Gilfix.Guido van Rossum2002-06-061-54/+420
| | | | | | | | | | | | | I've made considerable changes to Michael's code, specifically to use the select() system call directly and to store the timeout as a C double instead of a Python object; internally, -1.0 (or anything negative) represents the None from the API. I'm not 100% sure that all corner cases are covered correctly, so please keep an eye on this. Next I'm going to try it Windows before Tim complains. No way is this a bugfix candidate. :-)
* The insint() function is not used. Nuke it.Guido van Rossum2002-06-061-15/+0
|
* The tp_new implementation should initialize the errorhandler field,Guido van Rossum2002-06-061-1/+3
| | | | | | | | otherwise this code could segfault: from socket import socket s = socket.__new__(socket) s.recv(100)
* Repair widespread misuse of _PyString_Resize. Since it's clear peopleTim Peters2002-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | don't understand how this function works, also beefed up the docs. The most common usage error is of this form (often spread out across gotos): if (_PyString_Resize(&s, n) < 0) { Py_DECREF(s); s = NULL; goto outtahere; } The error is that if _PyString_Resize runs out of memory, it automatically decrefs the input string object s (which also deallocates it, since its refcount must be 1 upon entry), and sets s to NULL. So if the "if" branch ever triggers, it's an error to call Py_DECREF(s): s is already NULL! A correct way to write the above is the simpler (and intended) if (_PyString_Resize(&s, n) < 0) goto outtahere; Bugfix candidate.
* PyObject_Del can now be used as a function designator.Neil Schemenauer2002-04-121-1/+1
|
* Got rid of ifdefs for long-obsolete GUSI versions.Jack Jansen2002-04-111-15/+0
|
* Use the PyModule_Add*() APIs instead of manipulating the module dictFred Drake2002-04-011-201/+217
| | | | directly.