|
which website learn and solution C# window Application >
|
|
|
|
|
Um. This one?
Sorry, but your question is so vague that we can't really give any other answer (except "try Google.com", and you probably used that one to find this one ...)
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I thought: how does he come up with a handle like "knowledge share"; then I realized it was "knowedge"
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
|
None of them. The quickest way to learn is going to be books.
Websites just don't convey the level of detail and expansive coverage of the subject the way books do.
|
|
|
|
|
And the worst way is via YouTube. Even "get a copy of VS and start guessing the syntax" is better than most of them...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
|
Straightforward question for you gurus
AddressOrDNSName = "The dynamic DNS name given by my ASUS router"
This works perfectly on my Win 10 laptop connected with wifi to my LAN
IPAddress ipaddress = Dns.GetHostAddresses(AddressOrDNSName).FirstOrDefault();
But errors on my Win 10 Surface Pro connected with WiFi to my LAN with "No such host is known"
WTF ?
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
Are you sure the Surface Pro is configured correctly for Dns?
|
|
|
|
|
It's strange Richard because I can ping it from the command line on the Surface - what do you mean by configured correctly for DNS ?
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
Sorry Pete my mistake, I was thinking in pre-WiFi terms. DNS is managed in the router.
|
|
|
|
|
Try querying / refreshing the "arp cache".
arp | Microsoft Docs
And Ipconfig refreshes DHCP/DNS settings.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
modified 12-Jul-20 13:01pm.
|
|
|
|
|
The code below is for dicovering Logitech Media Servers running on my LAN
It works perfectly unless I have a server listening on the same pc ( Windows 10 ) as this code is running on.
It fails with "Only one usage of each socket address is normally allowed"
I have several of these servers running on my LAN and if I stop the one on my pc they are all found without error
int UDPPORT = 3483;
IPEndPoint ReceiveIP = new IPEndPoint(IPAddress.Broadcast,UDPPORT);
UdpClient ClientListener = new UdpClient(UDPPORT);
any ideas guys ?
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
modified 10-Jul-20 8:18am.
|
|
|
|
|
You cannot have multiple applications running on one system trying to listen on the same port.
|
|
|
|
|
Ok so that's why it works if the server is on a different box on the LAN
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
Exactly. A socket is like a telephone, it has a unique address (IP and port), and only one process can have the number at any one time. So if you have two processes on the same PC both listening on the same port, which one should be given the connection when a message arrives?
|
|
|
|
|
That's easy. You told the code to listen on a port that is already being used by another process.
Two processes cannot listen on the same port, be it another app entirely, or multiple instances of your app.
|
|
|
|
|
I see thanks
"We can't stop here - this is bat country" - Hunter S Thompson - RIP
|
|
|
|
|
Or you use a "proxy"; one "port" listener that forwards to your other listening "subscribers", depending on content.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Console.WriteLine("-----Enter at least 10 numbers-----");
int[] num = new int[10];
int input = 0;
while (input <= 10)
{
Console.Write("Enter a whole number: ");
num[input] = Convert.ToInt32(Console.ReadLine());
input++;
}
Console.Write("\nThis are the list of Even Numbers: ");
int Even = 0;
while (Even < 10)
{
if (num[input] % 2 == 0)
Console.Write(num[input]);
Even++;
}
Console.Write("\nThis are the list of your Odd Numbers: ");
int Odd = 0;
while (Odd < 10)
{
if (num[input] % 2 == 1)
Console.Write(num[input]);
Odd++;
}
Console.ReadLine();
|
|
|
|
|
We can't tell - we have no access to your code while it is running, or to your data, and you need both in order to find out why this occurs, much less fix it.
So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. If you don't know how to use it then a quick Google for "Visual Studio debugger" should give you the info you need.
Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.
When you know where the problem is and what values you are using, you can start comparing that to the actual spreadsheet and work out why.
Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
while (input <= 10) means that input can be 10 inside the loop. In fact it will be, though that is not immediately obvious just from the loop condition. By the way, that is why for loops are normally preferred for counted loops - you can tell immediately what the range of the loop counter is.
num[input] happens, so num[10] had better exist.
.. but it does not, because num is only 10 elements long, not 11.
|
|
|
|
|
int[] num = new int[10]; int input = 0; while (input <= 10)
{
Your int array contains only 10 items but your while loop accepts an index value of 10 which is beyond the array limit.
Change the while loop to
while (input < 10)
|
|
|
|
|
You have to be careful with array indexers. Array indexes always start at 0, not 1.
When you declared an array with int[] num = new int[10]; , you created an array with 10 elements, numbered 0 through 9.
So, when you put the limit expression in your while (input <= 10) , you said the last index in the array was 10, not 9.
|
|
|
|