Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


c#  why?,howto? Cannot implicitly convert type 'string' to 'System.Net.IPAddress'

Posted on 2008-06-19
Medium Priority
Last Modified: 2008-08-13
private IPAddress localaddr = Dns.GetHostEntry(textBox1.Text).AddressList[0].ToString();//"";

private IPAddress localaddr = "";

myListener = new TcpListener(localaddr,port);

localaddr, i'm stuck here, for debugging.

// Cannot implicitly convert type 'string' to 'System.Net.IPAddress'
Question by:Natural_Demon
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Expert Comment

ID: 21828272

private IPAddress localaddr = IPAddress.Parse("");
myListener = new TcpListener(localaddr,port);

Open in new window


Expert Comment

ID: 21828278
Try this

private IPAddress localaddr = IPAddress.Parse("");
LVL 10

Expert Comment

ID: 21828284
IPAddress localaddr =  IPAddress.Parse("");
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 21828494
thanks you for the promp rely,

IPAddress localaddr =  IPAddress.Parse(""

how to get addres of localhost?
LVL 18

Accepted Solution

philipjonathan earned 500 total points
ID: 21828558
localhost is always ''

Expert Comment

by:Rahul Goel ITIL
ID: 21828573

//For parsing the string to IP
IPAddress ip =  IPAddress.Parse("")
// To get the localhost IP
IPHostEntry iphost = Dns.GetHostByName(Dns.GetHostName());
IPAddress[] addr = iphost.AddressList;
for (int i = 0; i < addr.Length; i++)
                listBox1.Items.Add(string.Format("IP Address {0}: {1} ", i, addr[i].ToString()));

Open in new window


Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question