Re: [Dev-C++] Socket Programming - Newbie - sockaddr 16 bytes?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2004-11-07 14:07:15
|
The best thing with google is that if you misspell a word, you are likely to find a lot of hits anyway because of the huge number of indexed pages. Just the same with example source code. /Per W On Sun, 7 Nov 2004, Daniel K. O. wrote: > Krzysztof Kapu=C5=9Bcik wrote: > > > You could be right. I don't have the standard so I cannot be sure - if > > I am wrong and anyone have more accurate information - please reply. > > > > In Linux socket.h header file you can find: > > #define PF_INET x > > #define ... > > /* Address families AF_ - same as PF_ */ <=3D=3D note this > > > > I think we could assume that the values will be always equal. Why? > > Just because there are so many sources using AF_INET > > Then you could also assume that PF_INET =3D=3D AF_INET =3D=3D 2, and this= can be > considered right too: > > socket(2, 1, 6); /* "everybody" uses the same values anyways, so this > is "safe" */ > > > I even found on a Google search people writing references saying that > the correct way is to use: > > socket(AF_INET, SOCK_STREAM, PF_INET); > > Now *this one* I know for sure it's wrong, but if you type exactly this > on a Google search, you'll get some hits of people actually using this. > > > > The third thing is that socket() (as I found in google) checks for both > > AF_INET and PF_INET in function call and for sockaddr address family > > definition too - so probably it the contants change (AF_ not equal > > PF_) the socket() will work good. > > Yeah, probably. > But anyways, I prefer using PF_INET for a socket() call, so I'll be sure > that if I need to use the code on a "bizarre" (but working) sockets > implementation, this can't cause any problem. > > > > Daniel K. O. > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=3D5588&alloc_id=3D12065&op=3Dclick > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |