Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 1867:758c1374f303 legacy-trunk
Setup.in: added tkinter; rearranged the definition of PYTHONPATH so
that the module-specific components are in the section for that
module.
cursesmodule.c: patched it so it actually works.
tkintermodule.c: call Py_AtExit instead of atexit().
signalmodule.c: converted to new naming style; added
BGN/END SAVE around pause() call.
socketmodule.c: added setblocking() after Tommy Burnette.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 07 Sep 1994 14:32:49 +0000 |
| parents | a584b4bbbc59 |
| children | 80818c106e3e |
line wrap: on
line diff
--- a/Modules/socketmodule.c Tue Sep 06 16:19:33 1994 +0000 +++ b/Modules/socketmodule.c Wed Sep 07 14:32:49 1994 +0000 @@ -63,6 +63,7 @@ - s.recvfrom(nbytes [,flags]) --> string, sockaddr - s.send(string [,flags]) --> nbytes - s.sendto(string, [flags,] sockaddr) --> nbytes +- s.setblocking(1 | 0) --> None - s.shutdown(how) --> None - s.close() --> None @@ -80,6 +81,7 @@ #include <netdb.h> #include <sys/socket.h> #include <netinet/in.h> +#include <fcntl.h> #else #include <winsock.h> #endif @@ -441,6 +443,34 @@ #endif +#ifndef NT + +/* s.setblocking(1 | 0) method */ + +static object * +sock_setblocking(s, args) + sockobject *s; + object *args; +{ + int block; + int delay_flag; + if (!getintarg(args, &block)) + return NULL; + BGN_SAVE + delay_flag = fcntl (s->sock_fd, F_GETFL, 0); + if (block) + delay_flag &= (~O_NDELAY); + else + delay_flag |= O_NDELAY; + fcntl (s->sock_fd, F_SETFL, delay_flag); + END_SAVE + + INCREF(None); + return None; +} +#endif + + /* s.setsockopt() method. With an integer third argument, sets an integer option. With a string third argument, sets an option from a buffer; @@ -813,6 +843,9 @@ #if 0 {"allowbroadcast", (method)sock_allowbroadcast}, #endif +#ifndef NT + {"setblocking", (method)sock_setblocking}, +#endif {"setsockopt", (method)sock_setsockopt}, {"getsockopt", (method)sock_getsockopt}, {"bind", (method)sock_bind},
