Thread: C++ and LAN : How To?

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    1

    C++ and LAN : How To?

    Hello!

    I was wondering if there was some way to access the LAN ports through a C++ code, and if they are detected, give each computer an ID with a class or some sort of variable (such as COMPUTER1, COMPUTER2, and COMPUTER 3), then have variables applied to each computer (such as COMPUTER1.STR1, etc...), then have each computer display the GETLINE(CIN) function for these, read the inputs, and if one or more of those inputs equals something certain, a new function would be executed. I would also like to know if a certain one of the computers connected could display a certain COUT, while to other display a different COUT. I was wondering all of this to see if I could make a DOS or UNIX LAN game. Yes, I know, it's stupid, but I love command prompt games.

    Thanks!
    ~Matt2020

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Search the board . . . and maybe read up on networking. I don't know anything about the topic myself, other than that it's really compilcated, and you might want to wait until you know a bit more C++ before tackling it.
    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.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    9
    You can access networks and the internet from within a c++ program using sockets, or winsock if you're on windows. If you know c++ well enough, I suggest googling up Beej's Network Guide and Johnnie's Winsock Tutorial(one is for linux, the other for windows, but you should be able to draw from both of them). Of course it would also help to know a bit about networking, i.e. ports, ip addresses, etc.

Popular pages Recent additions subscribe to a feed