TechSpot

C programming

By ZaUcY
Aug 9, 2009
Topic Status:
Not open for further replies.
  1. hey guys, so i'd like to make a small program to assign ips if we need to for lan parties. I got a C compiler called "open watcom" but cant figure it out. whats a good complier for C that runs on windows? whats a good source for C commands? and last is there a way to get the list of variables used for windows? (the variable name assigned to hold the computers IP's)
     
  2. Kcircyrd

    Kcircyrd TS Rookie Posts: 316

    You are talking to the wrong site for programming advice.
    You need to tell us the limits of your programming experience. If you cannot figure out Watcom, you are perhaps not ready to do this.
     
  3. strategic

    strategic TechSpot Paladin Posts: 1,274

    Why would you say something like that???
    I'm sure somebody here knows about this!
     
  4. Kcircyrd

    Kcircyrd TS Rookie Posts: 316

    Perhaps. But they have been few and far between... to practically non existent. A programming site discusses nothing else, and you would benefit from the advice of many.
     
  5. ZaUcY

    ZaUcY TS Rookie Topic Starter Posts: 89

    i agree Kcircyrd but i had an account here so i posted here, i really have no experience. the most i have done was make simple programs in java with eclipse and i only executed in the complier. never could figure out how to make it a jar file really. i am taking a C class this seme so i can wait for that to start up.

    thanks anyways.
     
  6. LookinAround

    LookinAround TechSpot Chancellor Posts: 8,372   +167

    Don't know about "LAN parties" other then what i just googled online: you're having a bunch of people over with their own computer so you can share share the LAN and game?

    In which case, i think might be much simpler to configure your router to assign a specific ip for a specific computer (it differentiates and uniquely identifies them using each computer's hardware MAC address which is unique per computer). Router need be updated only one time when a new computer arrives. Would that approach meet your needs?
     
  7. jobeard

    jobeard TS Ambassador Posts: 13,426   +317

    use DHCP for all players and you then need only one static IP for the game server.

    back on the topic:
    Multiple issues confront you on this question.
    1. writing in the 'c' language
    2. writing a networking program
    3. and then attempting to force an IP address upon a specific MAC address
    (3) is not the paradigm for controlling addresses on a network;
    In a domain controlled environment (ie commercial companies) the DNS+DHCP servers
    are configured by the admin according to the company policies.
    For home users (ie workgroups), we have the simple technique show at the top or
    the brute force approach of assigning static ip address on every machine.

    Your choice :)
     
  8. LookinAround

    LookinAround TechSpot Chancellor Posts: 8,372   +167

    Ummm.. Maybe it wasn't clear from the post, but the "paradigm" is quite simple and quite common for home routers.

    It's called DHCP Address Reservation (i.e. Reserving IP addresses based on the requesting computer's MAC address).

    The function is found in all the Netgears i've used (and other vendor routers too tho i can't recall specific makes/models.. you can go look it up for your own)
    I can one-time setup/"reserve" a constant, pre-defined IP address for a computer with just a few mouse clicks. (And IMHO, i find Address Reservation even simpler since i can do it all from my router).. And btw if advising someone set a static IP on a computer i'd advise they STILL need the extra steps to configure their router to remove the static IPs from the DHCP assignment range :) /* edit* / as that is, otherwise, a common reason for IP address conflict error messages people report

    On a netgear router:
    1. Click LAN Setup then click Add Address Reservation (see images)
    2. Simply select the computer you want to reserve. (Use the default IP adress settings shown or you can change it if you like)
    3. Then click to Add and Apply your settings

    [​IMG] [​IMG]

    Seems pretty simple router setup, not brutal, to me :)
     
  9. ZaUcY

    ZaUcY TS Rookie Topic Starter Posts: 89

    well..... thanks for helping me with this but i just wanted to make this to help me understand C before my class begins. More like a project than a problem i have. we have set static ip's but i just wanted to make a simple program to you could run to set a different IP/Subnet to each machine.
     
  10. jobeard

    jobeard TS Ambassador Posts: 13,426   +317

    That is a make-work, non-productive approach.
    Forget 'C' programming as a solution and drop all static IP addresses --
    just use DHCP and everything will sort itself out. For the game server system, set those as
    static at the high end of the subnet, eg x.x.x.253
     
  11. ZaUcY

    ZaUcY TS Rookie Topic Starter Posts: 89

    ok thanks.... ill try and figure out with my switch.
     
     
  12. jobeard

    jobeard TS Ambassador Posts: 13,426   +317

    if you're reporting the true name of the device (ie switch) then there's nothing to figure out,
    a switch has no configuration whatsoever (nor does a hub).
    A switch *must* be connected to a router and that's where the subnet is controlled.

    For all your players, have them set the TCP properties for IP and DNS to AUTOMATIC
    and delete all static information that may already exist.
     
  13. ZaUcY

    ZaUcY TS Rookie Topic Starter Posts: 89

    yeah thats usually how we do it and we dont have any networking problems.... like i said earlier i just wanted to try and build a simple program only for my knowledge and experience with C.
     
  14. jobeard

    jobeard TS Ambassador Posts: 13,426   +317

    then you need to write a DHCP server which Listens on Port 67 + 68 and fulfills the
    specification found here
     
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.