Re: [Dev-C++] Socket Programming - Newbie - sockaddr 16 bytes?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Obi <ob...@ch...> - 2004-11-07 00:36:55
|
At 18:10 06/11/2004 -0200, Daniel K. O. wrote: >Obi wrote: > >> ls = socket( AF_INET, SOCK_STREAM, 0 ); > >This is not right. Never call socket() with an AF_ argument; it should be >PF_ (PF_INET in this case). AF_INET just "works" here by coincidence, >because most of the BSD-sockets implementations use the same value for >them. This is just as correct as using "socket(2, 1, 0);". You're right, my mistake. AF_ defines are for the sockaddr structures & PF_ for the socket call. However most of the literature uses AF_ for the socket call too. ( Some docs I have specifically say to use AF_ defines ). FYI the above formcompiled and ran fine on Win32, Solaris & Linux. |