Reputation: 787
I've created an Windows Service to run on my desktop with a client app for Windows Phone 7. The client needs to detect the machine running that service, so it sends a UDP broadcast over the network and expects a response with the server's IP address to know where to connect.
I'm able to send that broadcast, and receive it in the service. But that's where I'm stuck.
From what I've read, it is not possible to know where a UDP request comes from, or reply to one on the same socket (that second one I assumed through trial and error). The work around I had in mind was to put the phone's IP address or DNS Name in the UDP request and make the service respond to that over a different socket, but now I see it's not possible to get that information for a Windows Phone 7 device.
My question is, does anyone have any other suggestions for a technique I can look into to accomplish this?
If I really have to, I can just have the service send out a UDP request with that info and let the phone app do its thing from there, but I like not doing that for performance and etc. Any help would be great. Thanks in advance.
Upvotes: 1
Views: 253
Reputation: 35404
The Windows Service should be able to obtain the phone's IP address via the incoming socket object's RemoteEndPoint property (I'm assuming the service is written in C# as well).
Upvotes: 1