18 2.3 Guidelines to (Freelance web design) Address-Family Independent Socket Programming
18 2.3 Guidelines to Address-Family Independent Socket Programming 18 2.3 Guidelines to Address-Family Independent Socket Programming /* THIS IS A VERY BAD PRACTICE */ extern void foo(int); int in; in = htonl(0×7f000001); /* 127.0.0.1 */ foo(in); To handle IPv4 and IPv6 addresses, it is suggested you use sockaddrs, such as sockaddr_in or sockaddr_in6, always. With sockaddrs, the data contains the identification of address family, so we can pass around the address data and know which address family it belongs to. When passing pointers around, use struct sockaddr *, and let the called function handle it. extern int foo(struct sockaddr *); int main(argc, argv) int argc; char **argv; { struct sockaddr_in sin; /* setup sin */ foo((struct sockaddr *)&sin); } int foo(sa) struct sockaddr *sa; { switch (sa->sa_family) { case AF_INET: case AF_INET6: /* do something */ return 0; default: return -1; /*not supported*/ } }
We provides quality the CPanel Web Hosting. All our web hosting plans regular, business and expert are competitively priced and unsurpassed in reliability, uptime, and quality of service.
June 12th, 2011 at 6:49 am
hello…
really good article. Ready to hear more next week,my blog http://rockettqqq.insanejournal.com/6087.html Many Thanks….
June 13th, 2011 at 1:32 pm
hello…
really good article. Ready to hear more next week,my blog http://debbieqqq.onsugar.com/Adressing-Wedding-invites-Envelopes-17840597 Many Thanks….
June 16th, 2011 at 12:54 am
really good article…
I have spent a bit of time going through your posts, more than I should have but I must say, its worth it! http://joice071.blogs.sapo.pt/ many Thanks….
June 20th, 2011 at 1:29 am
hello…
Hi there thanks for the quality post! http://adam.weblogplaza.com/ ,i had a good read.appreciate your article,My problem has been resolved….
June 20th, 2011 at 2:46 pm
very helpful…
I preferred to thank you for this good article. http://tkzxy.canalblog.com/ I by all odds liked every little bit of it…
June 21st, 2011 at 11:58 am
Great…
You did a great job! http://denaa.blogs.sapo.pt/511.html…
June 22nd, 2011 at 2:56 am
Great…
You did a great job! http://danika.blogdiario.com/1308326045/…
June 26th, 2011 at 12:54 am
quality post…
I have spent a bit of time going through your posts! http://dena.bloginthedark.com/2011/06/19/the-bronze-age/ ,i had a good read….
June 27th, 2011 at 3:20 am
Greate…
It’s such a great site! http://blogtext.org/aleshabyali/article/573555.html Great post, I just bookmarked it on Digg….
July 18th, 2011 at 12:34 pm
Great One…
I must say, its worth it! My link!http://davis071.canalblog.com/ ,thanks haha…
August 9th, 2011 at 1:43 am
Great…
love your blog, http://www.2d4-gaming.net/index.php?site=forum_topic&topic=589 ,Thanks again….
August 12th, 2011 at 3:58 pm
Great One…
I must say, its worth it! My link, http://www.getjealous.com/bonnie11,thanks haha…
August 17th, 2011 at 4:27 pm
really…
Fat women and girls always worried because of their ugly shaped bodies. http://blog.nrj.fr/mnhjklio , but they can not wear these outwears…
September 1st, 2011 at 3:01 pm
very helpful…
I preferred to thank you for this good article. http://pcztew.blogonsisters.com/uncategorized/100-dollar-temple-wedding-gowns/ I by all odds liked every little bit of it…
October 21st, 2011 at 1:15 pm
Great…
I can’t watch a college basetball game, and I won’t be in a wifi area. Is there an app that doesn’t did wifi to check sport scores. I will be in a wifi area, but you have to know the password.. , http://tqhln.podbean.com/…
December 1st, 2011 at 8:56 pm
quality post…
ugg boots 6.5 love, http://www.elmodenawrestling.com ,thanks ugg…