Prev: CRC64 collision on 48bit input string.
Next: Bill Cunningham and sockets for the past six years
From: Bill Cunningham on 6 Apr 2010 09:12 I tried this just to see what would happen and it didn't compile. Here are my error codes, #include <stdio.h> #include <sys/socket.h> int tcp, bstat; tcp = socket(tcp, SOCK_STREAM, 0); bstat = bind(tcp, INADDR_ANY, 4096); int main() { if (tcp == -1) { perror("tcp error"); return 1; } if (bstat == -1) { perror("bind error"); return 1; } return 0; } p.c:5: error: initializer element is not constant p.c:5: warning: data definition has no type or storage class p.c:6: error: `INADDR_ANY' undeclared here (not in a function) p.c:6: error: initializer element is not constant p.c:6: warning: data definition has no type or storage class I haven't got my book so I'm reading man pages and online tutorials so far. Bill
From: Noob on 6 Apr 2010 10:40 Bill Cunningham wrote: > I haven't got my book so I'm reading man pages and online tutorials so far. Try Beej's Guide to Network Programming http://beej.us/guide/bgnet/
From: Scott Lurndal on 6 Apr 2010 13:23 "Bill Cunningham" <nospam(a)nspam.invalid> writes: > I tried this just to see what would happen and it didn't compile. Here >are my error codes, > >#include <stdio.h> >#include <sys/socket.h> > >int tcp, bstat; >tcp = socket(tcp, SOCK_STREAM, 0); >bstat = bind(tcp, INADDR_ANY, 4096); >int main() >{ > if (tcp == -1) { > perror("tcp error"); > return 1; > } > if (bstat == -1) { > perror("bind error"); > return 1; > } > return 0; >} >p.c:5: error: initializer element is not constant >p.c:5: warning: data definition has no type or storage class >p.c:6: error: `INADDR_ANY' undeclared here (not in a function) >p.c:6: error: initializer element is not constant >p.c:6: warning: data definition has no type or storage class > > I haven't got my book so I'm reading man pages and online tutorials so >far. > >Bill > You should learn "C" before you try sockets. scott
From: Bill Cunningham on 6 Apr 2010 14:49 "Noob" <root(a)127.0.0.1> wrote in message news:hpfh46$8rv$1(a)speranza.aioe.org... > Try Beej's Guide to Network Programming > http://beej.us/guide/bgnet/ > Ok Will do.
From: Bill Cunningham on 6 Apr 2010 17:21 "Scott Lurndal" <scott(a)slp53.sl.home> wrote in message news:O6Kun.92146$DU3.82888(a)news.usenetserver.com... > You should learn "C" before you try sockets. What do you mean? Do you mean I need to create instances of struct addr and then use elements of structs and pointers like in the prototypes? I hope it won't be that hard. If so I'll be learning alot about C. Bill
|
Next
|
Last
Pages: 1 2 Prev: CRC64 collision on 48bit input string. Next: Bill Cunningham and sockets for the past six years |