Hi,

I am writing a small echo client in C linux. The echo server is on Windows System. I am trying to use gethostbyname to resolve the Windows Hostname.
But I am not able to do so.

The name is not being resolved. I am able to use my application only with IP Address.

Let me explain my environment:

Router-----------windows(echo server)
|
|
|
Linux(echo client)


Both windows and linux systems have obtained ip address via dhcp from the Router.

my echo client is running on linux system.

i am able to use ip address. but my concern is i need to use the hostname as it is dhcp enabled and the ip address keeps on changing.

the router shows the windows hostname - ip address mapping.

windows-pc 192.168.10.100

but when i try to use gethostbyname() with the "windows-pc" as the argument for hostname, it can't resolve to the ip address.


am i missing something?
Is there any different function that i should use?


Also the windows pc is in a workgroup named "HARDWARE".

One more point is that I am able to run the "scp" command on my linux system to access the windows pc

#scp windows-pc

The point i am trying to make is that scp is able to resolve the windows-pc name into an ip address but my program can't. so i suspect is there any different function call.

please provide me suggestions.

Thanks

Best Regards,
allug