summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-07-01 18:51:33 (GMT)
committerGuido van Rossum <guido@python.org>1991-07-01 18:51:33 (GMT)
commit4dd2a7e45b649f6e956dd9e644e9df7b443bf176 (patch)
treed9de31bf47bd2f519ce1da167a88b16b3db9e643 /Modules/socketmodule.c
parent9db401333f3915c4bae0a1cfe045668832532704 (diff)
downloadcpython-4dd2a7e45b649f6e956dd9e644e9df7b443bf176.zip
cpython-4dd2a7e45b649f6e956dd9e644e9df7b443bf176.tar.gz
cpython-4dd2a7e45b649f6e956dd9e644e9df7b443bf176.tar.bz2
Connection sockets now have the proper family/type/proto values.
Fix argument handling bug in socket(f,t,p) call. Fix some comments.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index c0c9079..c5f6fe7 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -32,14 +32,14 @@ Limitations:
- only AF_INET and AF_UNIX address families are supported
- no asynchronous I/O
- no read/write operations (use send/recv instead)
-- no flags on send/recv operations
+- no flags on sendto/recvfrom operations
- no setsockopt() call
Interface:
- socket.gethostbyname(hostname) --> host IP address (string: 'dd.dd.dd.dd')
-- socket.getservbyname(server, type) --> port number
-- socket.socket(family, type) --> new socket object
+- socket.getservbyname(servername, protocolname) --> port number
+- socket.socket(family, type [, proto]) --> new socket object
- family and type constants from <socket.h> are accessed as socket.AF_INET etc.
- errors are reported as the exception socket.error
- an Internet socket address is a pair (hostname, port)
@@ -325,7 +325,10 @@ sock_accept(s, args)
return socket_error();
/* Create the new object with unspecified family,
to avoid calls to bind() etc. on it. */
- res = makepair((object *) newsockobject(newfd, AF_UNSPEC, 0, 0),
+ res = makepair((object *) newsockobject(newfd,
+ s->sock_family,
+ s->sock_type,
+ s->sock_proto),
makesockaddr((struct sockaddr *) addrbuf, addrlen));
if (res == NULL)
close(newfd);
@@ -666,7 +669,7 @@ socket_socket(self, args)
sockobject *s;
int family, type, proto, fd;
if (args != NULL && is_tupleobject(args) && gettuplesize(args) == 3) {
- if (!getintintarg(args, &family, &type, &proto))
+ if (!getintintintarg(args, &family, &type, &proto))
return NULL;
}
else {