473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

The requested address is not valid in its context ... IpAddress

2
I'm wanting to use an app.config file to set the port and IpAddress for a custom server. The problem is that I can't seem to get the Ip into the program.

Here is my code...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="port" value="500" />
<add key="ipadd" value ="173.31.1.125" />
</appSettings>
</configuration>

here is how I am trying to use it....

System.Net.IPAddress localhost = System.Net.IPAddress.Parse(System.Configuration.Co nfigurationSettings.AppSettings["ipadd"]);
localhost.Start();


Here is the error....
The requested address is not valid in its context

What do I need to do?
Sep 28 '07 #1
3 5732
Plater
7,872 Expert 4TB
ipaddress doesn't have a .Start() function to it, what are you trying to use it for?
Sep 28 '07 #2
ghost1
2
Sorry Forgot some of the code it should be:

System.Net.IPAddress localhost= System.Net.IPAddress.Parse(System.Configuration.Co nfigurationSettings.AppSettings["ipadd"]);
TCPListener MyListener = new TCPListener(localhost,port);
MyListener.Start();

Sorry ... rough day at work...brain freeze.
Sep 29 '07 #3
Plater
7,872 Expert 4TB
Unless you are doing something a bit sneakier, generally for listener devices("servers") you would want to use IPAny (I think it's IPAddress.Any, it's static, should be easy to find).
As to your error, I'm lost on that one, unless it's not comming back as a correct string?

EDIT: Actually I'm fairly certain that you can't "pick" an address like that to listen on. (If that is the computer's IP address I would think it would work but unsure)
Oct 1 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Michael Riggio | last post by:
Does anyone know why this property is obsolete? Also, is there an alternative available?
15
by: qazmlp | last post by:
What is the best & fastest way of validating an IPv4 address? Basically, the input can be either in IPAddressv4 or IPAddressv4:port format. Currently I have the following code to validate the...
5
by: Horst Walter | last post by:
What is wrong here? IPAddress ipAddress = IPAddress.Parse("10.10.20.1"); IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, this.port); this.tcpClient = new TcpClient(ipEndPoint); // PROBLEM HERE...
1
by: Alpha | last post by:
I'm getting a connection error when I used the following code to connect to a server on our LAN with IP address. Can someone take a look and tell me if you see something wrong? I'm just getting...
3
by: John J. Hughes II | last post by:
I have an application that uses a socket. One of the users was complaining that it would not work if they put the computer name in but only worked if they put the IP address in. I had them run...
4
by: Jerry Spence1 | last post by:
How do I convert "192.168.0.200" (as type string) to MyIP (as type IPAddress)? -Jerry
0
by: prateekbaxi | last post by:
Hi, Iam trying to write a small FTP client which accepts the IPAddress and connects to this FTP server. Now when I use DNS.GetHosbyAddress it failes and reutrns the Socket Exception "The...
14
by: NetworkElf | last post by:
Hi all, Does anyone have some code that shows an example of how to loop through a range of IP addresses? I'm using text boxes to get a start and end value for the range. I was thinking about...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.