Advertisement

Sending and receiving UDP broadcast message in C++ in Windows Phone.

Started by April 02, 2015 10:12 PM
30 comments, last by frob 7 years, 4 months ago

Hi!

I looking for example of sending and receving UDP Datagram broadcast message. I only find examples in C#, but I write my project in C++ and I don't know, how can I rewrite it. I know, that I must use DatagramSocket class. Maybe someone has similar problem. Thanks for ony help.

See the Forum FAQ, right at the top next to Q1. Four of those links, including Beej's Tutorial, hold your answer.

Advertisement

Ehh... In windows phone I cannot use clear WinSock. I must use DatagramSocket. I write it clearly before, please read carefully first.

Did you look here? https://code.msdn.microsoft.com/windowsapps/DatagramSocket-sample-76a7d82b
enum Bool { True, False, FileNotFound };

Yes, I look it there, but I'm new in internet programming, so I can't remake this sample in that way, that I want. Maybe do you have something closer to my problem?

According to my previous post to person, that gave me minus point, come on! I get drawbacks for what? For saying, that moderator isn't read carefully? No comment...

I look it there, but I'm new in internet programming, so I can't remake this sample in that way, that I want. Maybe do you have something closer to my problem?

In that case, start here.

That information on those links have helped thousands of people do what you wanted to do.

It requires work. There is no magic component you can download that does everything for you. The information is generic and applies to most situations, you must take the information, do some work, and turn it into something that works in your product.

Some follow up questions:

What have you actually done so far? What books, tutorials, and documentation have you already used and exhausted? What FAQs have you read?

And most importantly: What SPECIFICALLY about it does not work for you? That is, when you attempted to implement it in your program, what specific parts failed?

Advertisement

Ok, maybe nobody didn't make it for me, but giving me minus point for saying truth is ridiculus.

Backing to threat, I started from remake this datagram sample and I have one big problem, that broadcasting isn't working. My computer has adress in LAN:192.168.2.103, when I set this in program, I get message sending by its, but when I set brooadcasting adress 192.168.2.255 or 255.255.255.255, I didn't get message in this sample, can anybody help me with it?

Only omniscient beings, oracles, and time travelers can help you if you don't post your code...

use boost::asio rolleyes.gif

Link

Did you enable broadcast on the socket?
What tool do you use to test whether it "works" or not?
What does Wireshark say about outgoing UDP packets while you're trying to broadcast?

Also, there are more examples of this, such as: http://metronuggets.com/2013/03/18/how-to-send-and-receive-a-udp-broadcast-in-windows-phone-8-and-win8/
If you run this code, does that work? If so, what's different about your own code?
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement