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.

16 Responses to “18 2.3 Guidelines to (Freelance web design) Address-Family Independent Socket Programming”

  1. Matilde Says:

    hello…

    really good article. Ready to hear more next week,my blog http://rockettqqq.insanejournal.com/6087.html Many Thanks….

  2. Matilde Says:

    hello…

    really good article. Ready to hear more next week,my blog http://debbieqqq.onsugar.com/Adressing-Wedding-invites-Envelopes-17840597 Many Thanks….

  3. sander Says:

    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….

  4. Hehmer Says:

    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….

  5. Kugenie Says:

    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…

  6. Richelle Says:

    Great…

    You did a great job! http://denaa.blogs.sapo.pt/511.html…

  7. Benzing Says:

    Great…

    You did a great job! http://danika.blogdiario.com/1308326045/…

  8. Richelle Says:

    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….

  9. Dehmer Says:

    Greate…

    It’s such a great site! http://blogtext.org/aleshabyali/article/573555.html Great post, I just bookmarked it on Digg….

  10. Jenzing Says:

    Great One…

    I must say, its worth it! My link!http://davis071.canalblog.com/ ,thanks haha…

  11. Cenzing Says:

    Great…

    love your blog, http://www.2d4-gaming.net/index.php?site=forum_topic&topic=589 ,Thanks again….

  12. Ehantelle Says:

    Great One…

    I must say, its worth it! My link, http://www.getjealous.com/bonnie11,thanks haha…

  13. kander Says:

    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…

  14. Chantelle Says:

    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…

  15. Matilde Says:

    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/…

  16. Cenzing Says:

    quality post…

    ugg boots 6.5 love, http://www.elmodenawrestling.com ,thanks ugg…

Leave a Reply