diff options
author | Guido van Rossum <guido@python.org> | 1994-09-07 14:32:49 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1994-09-07 14:32:49 (GMT) |
commit | e4485b064d46ad8739df2919192ae0b488de88ba (patch) | |
tree | f42fbb5793179cf8aadbea190be09424d4bf0d0d /Modules/socketmodule.c | |
parent | a1426136786711bae9a5a576a0e4fbf27979cac9 (diff) | |
download | cpython-e4485b064d46ad8739df2919192ae0b488de88ba.zip cpython-e4485b064d46ad8739df2919192ae0b488de88ba.tar.gz cpython-e4485b064d46ad8739df2919192ae0b488de88ba.tar.bz2 |
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.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 8cacfb2..6f50fc3 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -63,6 +63,7 @@ Socket methods: - 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 @@ Socket methods: #include <netdb.h> #include <sys/socket.h> #include <netinet/in.h> +#include <fcntl.h> #else #include <winsock.h> #endif @@ -441,6 +443,34 @@ BUILD_FUNC_DEF_2(sock_allowbroadcast,sockobject *,s, object *,args) #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 @@ static struct methodlist sock_methods[] = { #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}, |