Click here to Skip to main content
16,020,714 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
HI ,
I need to get the server Dynamic Ip address to client for connectivity process

More details :
i am doing server & client file transfer process (its a 2ways communication ) using port & IP address , if server is a static no problem its working fine ,if in-case dynamic i need to get the server ip address for client at run time how come i!!



can any one help me will be more thankful!!
Posted
Updated 23-Nov-11 19:56pm
v2

1 solution

Try:
C#
string webaddress= "www.codeproject.com";
IPAddress[] ips = Dns.GetHostAddresses(webaddress);
foreach (IPAddress ip in ips)
   {
   Console.WriteLine(ip.ToString());
   }
 
Share this answer
 
Comments
AZAD88 26-Nov-11 0:29am    
Hi Friend ,
I have used this code before but my point is client want to know the server system ipaddress!
OriginalGriff 26-Nov-11 2:44am    
That is the server IP address...
AZAD88 26-Nov-11 3:05am    
on your point I need too mention the server name here : string webaddress= "AZAD" Right!!
OriginalGriff 26-Nov-11 3:08am    
On your reply, did you try it? Because I just did and my DNS picked up the IP of the local host correctly...
AZAD88 26-Nov-11 3:16am    
hey I tried! it gets the ip of Local machines & Any url ip ,but i dont need that

Need 1 : customer had a Dynamic server in his showroom ,salesperson (i.e client as gone out with the laptop )for the transaction client need the server ip address (too connect the server)

plz reply me soon

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900