Changing TCP/IP settings

  • Thread starter Thread starter Robert
  • Start date Start date
R

Robert

I am trying to figure out how to change TCP/IP settings through VC# (IP
Address, DNS, WINS, Gateway, Computer Name, Host, etc), but cannot find
anything anywhere. I'm sure that it's out there, but I am not finding it.
Does anyone have some info as to where I may find this, or any code or ideas
that may be of help? I've searched the documentation that came with VC#,
but cannot find anything. (I'm sure it's there, but I haven't been able to
find it.) I also have several books, but they tell you how to create a
connection, but not how to change the settings.

Rob

Thank you for any help in advance.
 
Robert said:
I am trying to figure out how to change TCP/IP settings through VC# (IP
Address, DNS, WINS, Gateway, Computer Name, Host, etc), but cannot find
anything anywhere. I'm sure that it's out there, but I am not finding it.
Does anyone have some info as to where I may find this, or any code or ideas
that may be of help? I've searched the documentation that came with VC#,
but cannot find anything. (I'm sure it's there, but I haven't been able to
find it.) I also have several books, but they tell you how to create a
connection, but not how to change the settings.
Rob -

All of this information can be found in the Registry. You can use
the classes in the Microsoft.Win32.Registry and
Microsoft.Win32.RegistryKey namespaces to query and modify these
values.

On Windows NT, 2000, and XP machines the IP settings are stored
under each individual network interface card. You can obtain a listing
of the installed network cards from the
HKLM\Software\Microsoft\Windows NT\CurrentVersion\NetworkCards
Registry key. Once you have a list of the installed network cards, you
can see their individual IP settings under the
HKLM\SYSTEM\CurrentControlSet\Services key, listed under the same key
name of the network card.

In Chapter 2 of my C# book I demonstrate using the Registry to
obtain IP address information. You can freely download the example
code from the Sybex web site. It should not be too difficult to change
the code to modify the IP settings. Hope this helps get you started on
your journey. Good luck with your project.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0471433012.html
 
Back
Top