3 % (c) The GRASP/AQUA Project, Glasgow University, 1995
5 \subsection[createSocket.lc]{Create a socket file descriptor}
10 #define NON_POSIX_SOURCE
12 #include "ghcSockets.h"
16 createSocket(I_ family, I_ type, I_ protocol)
20 if ((fd = socket((int)family, (int)type, (int)protocol)) < 0) {
28 ghc_errtype = ERR_PERMISSIONDENIED;
29 ghc_errstr = "cannot create socket";
32 ghc_errtype = ERR_RESOURCEEXHAUSTED;
33 ghc_errstr = "Too many open files";
36 ghc_errtype = ERR_RESOURCEEXHAUSTED;
37 ghc_errstr = "System file table overflow";
39 case GHC_EPROTONOSUPPORT:
40 ghc_errtype = ERR_UNSUPPORTEDOPERATION;
41 ghc_errstr = "Protocol type not supported";
44 ghc_errtype = ERR_INAPPROPRIATETYPE;
45 ghc_errstr = "Protocol wrong type for socket";