[LCP]Problem with GNU C sockets
Greg Black
gjb at gbch.net
Mon Sep 8 13:55:02 UTC 2003
On 2003-09-08, James McLean wrote:
> The basic C structure is not a problem, but I have been looking at the
> GNU C Sockets documentation to learn how to program the sockets, and
> borrowed the example outlined on the site.
You should read the man page for socket(2) and all the other
pages that it leads you to.
> /usr/include/sys/socket.h:52: syntax error before `sa_family_t'
Errors like the above always mean that you forgot to include
<sys/types.h> ...
> #include <stdio.h>
> #include <stdlib.h>
#include <sys/types.h> /* required *before* sys/socket.h */
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <netdb.h>
There are other bugs, but this will get you started. But in
future, read the relevant man pages before posting questions.
Cheers, Greg
--
Greg Black <gjb at gbch.net> <http://www.gbch.net/gjb.html>
GPG signed mail preferred; further information in headers.
More information about the linuxCprogramming
mailing list