Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. C# Change IP Address

C# Change IP Address

Scheduled Pinned Locked Moved Mobile
csharpquestiontutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dataminers
    wrote on last edited by
    #1

    How can I change IP address using with C# on Windows CE OS. I use .NET Compact Framework (3.5), how can I change IP address? And SubnetMask, DefaultGateway, DNS. If you know openNETCF example, please write link, I found same class but I can't use it, because this class is privite. Thanks...

    P 1 Reply Last reply
    0
    • D dataminers

      How can I change IP address using with C# on Windows CE OS. I use .NET Compact Framework (3.5), how can I change IP address? And SubnetMask, DefaultGateway, DNS. If you know openNETCF example, please write link, I found same class but I can't use it, because this class is privite. Thanks...

      P Offline
      P Offline
      pc18
      wrote on last edited by
      #2

      Hi, have you found the solution to your question? I am currently searching for a solution myself. I am using this code on a Windows Mobile 6 device, but it doesn't seem to set the IP to the hardcoded one. Instead, it stays 0.0.0.0. Maybe you or someone else can figure this out. Cheers! private NetworkInterface wireless_interface; System.Net.IPAddress ip = System.Net.IPAddress.Parse("192.168.16.1"); if (wireless_interface == null) return; wireless_interface.CurrentIpAddress = ip; wireless_interface.Bind();

      P 1 Reply Last reply
      0
      • P pc18

        Hi, have you found the solution to your question? I am currently searching for a solution myself. I am using this code on a Windows Mobile 6 device, but it doesn't seem to set the IP to the hardcoded one. Instead, it stays 0.0.0.0. Maybe you or someone else can figure this out. Cheers! private NetworkInterface wireless_interface; System.Net.IPAddress ip = System.Net.IPAddress.Parse("192.168.16.1"); if (wireless_interface == null) return; wireless_interface.CurrentIpAddress = ip; wireless_interface.Bind();

        P Offline
        P Offline
        phil o
        wrote on last edited by
        #3

        Hi, At first sight I see a major issue in the code you provided :

        private NetworkInterface wireless_interface;
        ...
        if (wireless_interface == null)
        return;

        Since you never assign the wireless_interface variable to an instance of NetworkInterface, it will always be null ; thus your method will always return before reaching the wireless_interface.CurrentIpAddress = ip; line.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups