3 % (c) The GRASP/AQUA Project, Glasgow University, 1996
5 \subsection[acceptSocket.lc]{Server wait for client to connect}
10 #define NON_POSIX_SOURCE
12 #include "ghcSockets.h"
16 acceptSocket(I_ sockfd, A_ peer, A_ addrlen)
20 while ((fd = accept((int)sockfd, (struct sockaddr *)peer, (int *)addrlen)) < 0) {
28 ghc_errtype = ERR_INVALIDARGUMENT;
29 ghc_errstr = "Not a valid descriptor";
32 ghc_errtype = ERR_INVALIDARGUMENT;
33 ghc_errstr = "Address not in writeable part of user address space";
36 ghc_errtype = ERR_INVALIDARGUMENT;
37 ghc_errstr = "Descriptor not a socket";
40 ghc_errtype = ERR_INVALIDARGUMENT;
41 ghc_errstr = "Socket not of type that supports listen";
44 ghc_errtype = ERR_OTHERERROR;
45 ghc_errstr = "No sockets are present to be accepted";