I'm trying to compile some code from a TCP/IP book. It uses the BSD socket API. I get some compiler errors. Here's what I'm executing:
% gcc -o echo TCPEchoClient.c -lsocket
TCPEchoClient.c: In function `main':
TCPEchoClient.c:15: storage size of `echoServAddr' isn't known
TCPEchoClient.c:40: `IPPROTO_TCP' undeclared (first use in this function)
This is likely a linking issue or maybe an incomplete/modified header somewhere. But before I go nuts trying to find stuff I wanted to bring it your eyes in case you see something fishy with the gcc command above.
Below is a code snipplet that includes the includes ;-)
#include <stdio.h> /* for printf() and fprintf() */
#include <sys/socket.h> /* for socket(), connect(), send(), and recv() */
#include <arpa/inet.h> /* for sockaddr_in and inet_addr() */
#include <stdlib.h> /* for atoi() and exit() */
#include <string.h> /* for memset() */
#include <unistd.h> /* for close() */
Any tips appreciated.
Thanks!
