if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0)
errexit("can't connect to %s.%s: %s\n", host, service,
strerror(errno));
return s;
}
复制代码
Things should be changed for Solaris :
(NO change is needed for FreeBSD and Linux systems)
1.add the following to the Makefile:
。 -lsocket -lnsl to CFLAGS (for socket and related system calls)
。CC = gcc (compiler, some files required by cc are missing, we have to use gcc instead)
2.errno.h is in the directory /usr/include, NOT in the directory /usr/include/sys
。you should change all the occurrences
3.make the following changes to the file TCPtecho.c
。include another header file: <sys/filio.h> (constant FIONBIO is defined here)
。define the macro MIN, which returns the min. of two integers