% connectTCP.c -- connectTCP routine % Bert Bos % 17 Feb '94 Creating TCP sockets Based on the book `Internetworking with TCP/IP Volume III' by Douglas E. Comer \& David L. Stevens, Prentice-Hall, 1993. [[connectTCP]] connects to a specified TCP service on a specified host. The arguments are: [[host]] = name of host or internet number to which connection is desired; [[service]] = service associated with the desired port or the port number; [[block]] = whether to use blocking or non-blocking I/O. The return value is the socket descriptor or -1 in case of error. <<*>>= #include #include "connectsock.e" EXPORT int connectTCP(char *host, char *service, Bool nonblock) { return connectsock(host, service, "tcp", nonblock); }