Comments (9)
Hi,
To clarify, is this just broken for you in a .Net core app, or does the sample console app run on the regular desktop framework cause you an issue?
Also, are you running on Windows or in another environment?
The sample console app works for me on a Windows machine using the desktop framework. I can use p then u, or just r, and both u & r searches return appropriate device lists.
Can you provide me with a sample .Net core project that is not working for you? I'm having some tooling issues creating new .Net core projects at the moment.
Finally does it work if you pass a specific IP address into both publisher & locator? Sometimes (such as when I have a VPN open) I've found the auto address selection in Windows/Net picks different adapters for publisher & locator if you're not explicit.
from rssdp.
So on a regular windows machine, p and u and regular searches work just fine. Just took the contents of sample program.cs and tossed it into a new file same as I did for .net core.
I dont see how to set the ip address explicitly, but based on the error messages... it does seem like those sort of networking issues could be related.
I'd be more than willing to dig in a bit further... this seems like this would make some stuff I'm trying to do dramatically better... I was unable to build as I dont have framework 4.0.3 and couldnt find a targetting pack for it, but if I can track down the problem, I'll send a pull request for the change.
from rssdp.
Not at home right now so can't follow up immediately sorry. Try https://www.microsoft.com/en-us/download/details.aspx?id=29052 for the targeting pack, I think that's the right link.
I thought the constructors took up addresses, but maybe you need to create your own socketfactory instances and pass the ips into that.
Are you running the net core project on Windows too?
from rssdp.
I was able to get the project compiling using that link to the targeting pack. I did indeed setup another project similar to the samples and it seems like out of box the samples did not work in .net core. I'll experiment with the suggestions you made about socket factory etc and see if i cant get that worked out. If I can actually get to the bottom of it, I'll submit a pull request. (if there infact needs to be any changes)
from rssdp.
So it looks like whats happening for me anyway is that when the sample app gets the search request and starts to send a response... it blows up on line 78 of UdpSocket.cs, in "SendTo".
_Socket.SendTo(messageData, new System.Net.IPEndPoint(IPAddress.Parse(endPoint.IPAddress), endPoint.Port));
When I hit a break point prior to exceptions, the endpoint here is set to 0.0.0.0:0. IPAddress.Parse fails to parse 0.0.0.0 and ultimately it throws an exception. Note that this is with socketpool hardcoded to my local ip (192.168.xxxxxx)
from rssdp.
I won't be able to look at this until later to night my time, at the earliest, sorry.
From memory 0.0.0.0 is the value if IPAddress.Any, which on Windows tells .Net/Windows to pick any/'the best' available address. IPAddress.Parse should cope with ti fine, though I am not sure why we would try to send to that address. Sending to any random address doesn't make much sense. I think endPoint.IPAddress is supposed to be the end point of the device that sent the request?
Are you running this on Windows or something else?
What is the type of exception thrown?
What is the message on the exception?
from rssdp.
Oh no problem... I certainly didn't expect you to drop everything for this little issue. I'm in the middle of setting up a new laptop, so I'll have to get you some of the details as I have access to them too.
Running on windows 10. I agree that it should point at the device that sent the request, but havent had enough time to actually try and dig into the "where is the actual discrepancy?" question.
I'll update this when I get the exact exception type and message. I even tried evaluting the IPAddress.Parse("0.0.0.0") in immediates window at debug time, and got a parse exception.
from rssdp.
I may have just fixed this. Try the 2.0.0.5 version of the package. Please let me know if it works & close the issue if so.
There is a difference between the receive method used in .Net Core vs the other platforms. In the alternate code path the 'endpoint' is passed to the receive method by ref, and the function returns the actual endpoint of the system that sent the received message. On .Net Core the parameter is not (cannot) be passed by ref, instead the result of the function includes a property with the relevant endpoint info.
The person who wrote the .net core version modified the code so it compiled. by removing the ref keyword, but that left it with the default value of IPAddress.Any, which isn't where the message came from and is invalid for sending to.
If you look at the UdpSocket class in the latest commit you should see the changes I made.
from rssdp.
this indeed seems to addressed those problems. Now I can play with it a bit more. Appreciate the help!
from rssdp.
Related Issues (20)
- Target .NET Standard 2.0
- How to remove "schemas-upnp-org:device" from Notify Device Type Messages HOT 2
- discovery HTTP-headers without CR+LF
- Unhandled exception when UdpSocket is disposed but inner disposed socket receives an input
- About the Location item in SSDProotDevice
- Newlines are not sent HOT 1
- RSSDP Not Finding All Devices HOT 1
- RSSDP can't find all the IP addresses on my LAN
- Advertise C# WCF app so that it appears in the Network explorer
- Upnp Pentest Toolkit Device(Error)
- Needing to call SearchAsync() repeatedly and unable to receive notifications from remote devices HOT 3
- DeviceUnavailable callback never called
- SearchAsync does not actually start an M-Search
- iOS and SearchAsync HOT 1
- Method when `SearchAsync` is ended with no response?
- uPnP discovery suddenly stopp working? HOT 10
- IndexOutOfRangeException in SsdpTraceLogger.WriteLogMessage HOT 1
- Cancellation Token for SearchAsync HOT 1
- RSSDP doesn't work HOT 2
- Cannot find any device on phone HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rssdp.