Networking with ANSI C++

This is a discussion on Networking with ANSI C++ within the C++ Programming forums, part of the General Programming Boards category; Hello! I have been programming in C and C++ for quite a long time now, but I've just started a ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    45

    Networking with ANSI C++

    Hello!

    I have been programming in C and C++ for quite a long time now, but I've just started a new project and I'm completely stumped.

    What I want to do is write a cross platform network module in ANSI C++.

    Is this even possible, or do I need to resort to platform specific libraries?

    Thanks!

  2. #2
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    907
    ANSI C++ does not include standard network support. However, I'm sure there's some cross-platform SDK/runtime thingy that you could use.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    45
    Damn! I feared this, heh.

    I've been reading about this ACE stuff... Is that the kind of thing people tend to use? Performance is going to be a massive issue...

    On a low level, how do you go about implementing network protocols?? Is it just impossible? I guess it's all dependent on drivers which are OS specific etc, but it seems strange somehow that there isn't a standard interface... I dunno...

    I kinda feel cheated. Hold me

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    You could write a cross-platform POSIX C++ program with POSIX sockets: Beej's Guide to Network Programming

    They work with Linux and UNIX and Windows (just add a few lines and use winsock).
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    45
    Thank you dwks, awesome link, i'll look into that

  6. #6
    Registered User
    Join Date
    Apr 2007
    Posts
    45
    mmmmmmmmmmmmm this does indeed look perfect... !!

    and this wiki entry :
    http://en.wikipedia.org/wiki/OSI_model

    damnnnnnnn I love wiki....!!

    thanks again

  7. #7
    Registered User
    Join Date
    Apr 2007
    Posts
    45
    wow this tutorial is amazing...

    this beej guy needs a pat on the back!!

  8. #8
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    you could also try the asio library, which will be part of the next boost release (in fact, I believe it's been submitted for inclusion with the next version of C++!)
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  9. #9
    Registered User
    Join Date
    Apr 2007
    Posts
    45
    "semi-colon generator"
    hahahahahahahahahahahaha nice nice nice

  10. #10
    Registered User
    Join Date
    Apr 2007
    Posts
    45
    oh and i will check that out!

  11. #11
    Registered User
    Join Date
    Apr 2007
    Posts
    45
    oh mannnnnn this looks cool too!!!

    i'm going to be up all night reading this lot, haha, fantastic.

  12. #12
    Registered User
    Join Date
    Apr 2007
    Posts
    45
    6.30am I was up till!!! hahaha

    I can't decide whether to use boost or sockets
    we are one

  13. #13
    Registered User
    Join Date
    Apr 2007
    Posts
    45
    I think I'm settling on sockets... Does that make me evil?

    After I see a certain number of wrappers my brain just starts screaming "no"......
    we are one

  14. #14
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    Quote Originally Posted by wiiire View Post
    I think I'm settling on sockets... Does that make me evil?

    After I see a certain number of wrappers my brain just starts screaming "no"......
    It depends on who you ask.

    You could always write your own wrapper on top of sockets and Boost, and use that. That's what I do sometimes with ncurses and the SDL . . . .
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  15. #15
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by wiiire View Post
    I think I'm settling on sockets... Does that make me evil?

    After I see a certain number of wrappers my brain just starts screaming "no"......
    nope, both are valid choices. personally I would use asio a) because it's already done alot of the socket work for you (which is always a good thing) and b) because it's likely to become the standard C++ way of networking (so it'd be good to have a headstart on it).

    but horses for courses...
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. networking comfirmation
    By rEtard in forum Networking/Device Communication
    Replies: 1
    Last Post: 07-20-2005, 04:59 PM
  2. how closely does vc++.net 2003 follow ANSI?
    By krygen in forum C++ Programming
    Replies: 7
    Last Post: 09-22-2004, 07:48 PM
  3. sigaction() and ANSI C
    By awoodland in forum Linux Programming
    Replies: 4
    Last Post: 04-25-2004, 02:48 AM
  4. Beyond MFC : COM || Networking
    By kuphryn in forum Windows Programming
    Replies: 5
    Last Post: 04-25-2002, 05:28 PM
  5. C++: Reference Book, GUI, Networking & Beyond
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 11-10-2001, 08:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21