Thread: Changing IP Address Programmatically

  1. #1
    Registered User jaro's Avatar
    Join Date
    Mar 2006
    Location
    In my Parent House
    Posts
    34

    Changing IP Address Programmatically

    Hi,

    I would like to make a program that would change my IP address by just clicking a button.

    I'm not asking to make a program, but can you give me at least a link to a tutorial on how to do it.

    I've done some googling but most I found are not to my liking.

    regards,
    jaro

    p.s. sorry if my english is bad it is not my 1st language.

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    The board would need to know you OS in order to give any specific input...

    Further, why? I find issues to arise whenever mine changes...
    Furthermore, since my IP is allocated from DHCP, and my router chooses the lowest available, I'm likely to get exactly the same one. (I have no idea if I can force a change...)
    You could statically assign yourself one, but that sort of defeats the point of "static" IP...
    And if you're behind a router, you face the issue that your computers IP != the IP that the Internet sees.

    On my Win98 box, I can:
    Code:
    ipconfig /release_all
    ipconfig /renew_all
    But that gets me the same IP. (Gotta love my router...) (Unless someone else takes it between the two commands.)
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Registered User jaro's Avatar
    Join Date
    Mar 2006
    Location
    In my Parent House
    Posts
    34
    my OS is WinXp
    the reason for changing IP is for me to connect to module/rack that I'm using for my school.
    I guess I'm just tired of clicking in changing IP address manually.

    thanks for the quick reply.

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Look at http://msdn2.microsoft.com/en-us/library/aa394595.aspx

    Using WMI you can perform it in a simple script (look at the Use the Win32_NetworkAdapterConfiguration class and the EnableStatic method.)
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    Registered User jaro's Avatar
    Join Date
    Mar 2006
    Location
    In my Parent House
    Posts
    34
    Quote Originally Posted by vart View Post
    Look at http://msdn2.microsoft.com/en-us/library/aa394595.aspx

    Using WMI you can perform it in a simple script (look at the Use the Win32_NetworkAdapterConfiguration class and the EnableStatic method.)
    thanks for the info.

    this helps alot.

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Has left the C/C++ area and gone into tech realm. Moved.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. IP address network order to string?
    By pobri19 in forum Networking/Device Communication
    Replies: 1
    Last Post: 04-19-2009, 05:15 AM
  2. hidding the host ip address
    By xddxogm3 in forum Tech Board
    Replies: 4
    Last Post: 04-25-2006, 08:50 PM
  3. systray app to get IP Address
    By bonkey in forum Windows Programming
    Replies: 17
    Last Post: 09-19-2003, 08:10 AM
  4. MSN Vital Information
    By iain in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 09-22-2001, 08:55 PM