Differences between current version and predecessor to the previous major change of NetworkProgrammingOld.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 4 | Last edited on Thursday, July 28, 2005 10:14:51 pm | by MattBrown | |
Older page: | version 3 | Last edited on Tuesday, February 17, 2004 5:35:22 pm | by AristotlePagaltzis | Revert |
@@ -23,18 +23,13 @@
if (!protocol) {
printf("Could not getprotobyname");
!exit(1);
}
- server=socket(PF_INET,SOCK_STREAM,protocol.
p_proto);
+ server=socket(PF_INET,SOCK_STREAM,protocol->
p_proto);
if (server<0) {
perror("socket");
!exit(2);
}
-
-((((in above protocol is a pouinter to a struct therefore the call to socket should read as
- server=socket(PF_INET,SOCK_STREAM,protocol->p_proto);
-CM
-))))
;2: Then we create an address to bind it to. We don't care which of our local IP's we bind it to so we choose "INADDR_ANY" (all interfaces)
struct sockaddr_in address;
address.sin_family = AF_INET;