|
|
Comments and Discussions
|
|
 |

|
I am using Windows Sockets 2 (winsock2.h) for a program that will connect to a host computer named MyHost that runs a HTTP server, listening on Port 80.
MyHost has DHCP enabled & the IP assigned to it automatically is, say 157.184.205.117.
My program connects to the host computer using its Hostname & not its IP address. (this is a requirement)
On running my program on my local computer:
1. I can successfully connect to MyHost using HTTP over TCP/IP on Port 80.
2. I can successfully send [send()] data to MyHost.
3. I can successfully receive [recv()] the response from MyHost.
All communication is absolutely fine & works well.
Now here's problem:
If now - I turn off DHCP on MyHost & provide it a static IP address, say 157.184.205.111 - my program cannot connect to MyHost anymore.
I have also observed the following:
1. If, from within my program, I try to resolve the IP address of MyHost using the gethostbyname() function & other calculations, I receive the same old IP address of MyHost (157.184.205.117) instead of the newly assigned static IP address (157.184.205.111).
2. If I PING to MyHost from the Windows XP Command Prompt, it tries to connect to the old IP address of MyHost (157.184.205.117) instead of the newly assigned static IP address (157.184.205.111). So pinging also fails.
3. If I try to open in Internet Explorer, the url "http://MyHost" it fails to open the address.
Before assigning the host the static IP address, everything worked fine:
1. My Socket program connected.
2. Ping worked.
3. Internet Explorer worked.
Does anyone know a way to work around this problem?
That the hostname "MyHost" will be used to connect to the host, is a requirement.
The whole thing is getting me confused.
|
|
|
|

|
hello,
i have a device with Ethernet port, i have the MAC address of that device,
i want to set custom ip address to that ethernet port remotely from a PC.
if u know any APIs plz reply me,
that will be of gr8 help to me.
Thanks in advance
Ajith
Ajith
|
|
|
|
|
|

|
I know this program only works if you have one network card. I have a need to be able to set the ip address on computers with more than one network card. However, instead of setting all of the network cards to the same ip address, I need to be able to set the ip address of the active network card. For instance, my laptop has wired and wireless network adapters. I only want to change the ip address of the wired adapter, but not the wireless one. My program has to be able to work on any Windows computer (NT, 2000, or XP) with multiple network adapters. Does anybody have any suggestions?
|
|
|
|

|
I tested Gert Boddaert's tool and got an error message. The reason: The tool searches in SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\1 for the name of the network card adapter. I had installed a second adapter and removed the first one, so that my computer has no such entry - it has ...\\NetworkCards\\2 instead.
When compiling the software I had to download CRegistry.zip and found here another error: in "RegistryKey.cpp" the module
"bool CRegistryKey::QueryValue( LPCTSTR pValueName, DWORD >&dwValue)" does not set "ok=true" on success so it always returns false ...
Besides this, it works! But it does not solve the main problem: to change the IP address without rebooting - there are some undocumented dll entries anywhere! Open sources ??!!
neha
|
|
|
|

|
I've tryed to change a machine's ip these days.
In SDK document, IP Helper Api told us, we can use "AddIPAddress" and "DeleteIPAddress" to change the machine's IP. But "AddIPAddress" can only add none persistent IP, and "DeleteIPAddress" can not delete the current IP address.(PS: this current IP is not the CurrentIpAddress of the PIP_ADAPTER_INFO structure. We can band more than one IP to an adapter, but in the control panel we can see only one. So I called such IP as the current ip. If somebody knows what's this means, would u tell me?)
So I think "AddIPAddress" and "DeleteIPAddress" can only maintain the none persistent IP. These two functions dosen't change the register, but change the real network settings, although it's functions is too puny.
On the other way, I used "netsh"(a command in Windows2000). This command can maintain the "persistent". It gets the network parameters from register, and renew the register after it changed the parameters. Of course, netsh is not only a "regiter tool". It also can change the real parameters without reboot.
IP Helper API is not a powerful enough API. But in netsh, Microsoft can change the network settings freely. So I guess, Microsoft used another API to apply the network parameters to take effect. Perhaps it's an API without open.
Thanks for your reading
|
|
|
|

|
You can add more than one IP addresses to an adapter from the control panel as well (works on Win2k, XP - cannot recall the procedure for NT4).
Select the Internet Protocol(TCP/IP) and Press Properties. Give the first IP address and press the Advanced button. Now you can Add in "IP Settings" Tab as many ip addresses you want.
...Plug & Pray...
|
|
|
|

|
>Problem
>How do we change the computer and network host name?
>How do we choose between the usage of DHCP or a static IP address?
>How do we change the static IP address?
There's a command-line utility in Win2K (maybe not in NT?) called netsh that allows you to do the last two items.
For instance
netsh interface ip set address "Local Area Connection" dhcp
sets the interface to DHCP, and
netsh interface ip set address "Local Area Connection" static %StaticIP% 255.255.255.0 %GateIP% 1
sets the interface to static, defines an IP, a netmask and a default gateway IP (note - use real IPs or set the environment variables StaticIP, etc. ...)
The flag –r (then followed by an IP or machine number) specifies execution on a remote machine. (I haven't experimented with this one, though...).
I'm not sure how ipconfig can help with any of this.
Bob
PS: I did some work with NT/E some years ago. As I remember, the recommended way to use the console in a headless system was to log in using NetMeeting. You had to request a connection with the target machine name itself (not some person or process at the machine), the connection had to be "private" (or something like that) and the account you were calling from had to be part of the administrators group on the target machine. The advantage of NetMeeting was that it was "free" as it came with NT and W2K - so it didn't add to the total system cost we were asking customers to pay.
|
|
|
|

|
I tested Gert Boddaert's tool and got an error message. The reason: The tool searches in SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\1 for the name of the network card adapter. I had installed a second adapter and removed the first one, so that my computer has no such entry - it has ...\\NetworkCards\\2 instead.
When compiling the software I had to download CRegistry.zip and found here another error: in "RegistryKey.cpp" the module
"bool CRegistryKey::QueryValue( LPCTSTR pValueName, DWORD >&dwValue)" does not set "ok=true" on success so it always returns false ...
Besides this, it works! But it does not solve the main problem: to change the IP address without rebooting - there are some undocumented dll entries anywhere! Open sources ??!!
Werner
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Do you want to change a Host name, DHCP or static IP settings?
| Type | Article |
| Licence | CPOL |
| First Posted | 8 May 2000 |
| Views | 178,856 |
| Bookmarked | 46 times |
|
|