EldoS | Feel safer!

Software components for data protection, secure storage and transfer

How to use UDPTransport to broadcast?

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#26284
Posted: 09/03/2013 22:06:13
by luols (Basic support level)
Joined: 09/03/2013
Posts: 4

How to use UDPTransport to broadcast?

I want to broadcast message in server, and how to send the message and receive the message in client? thanks in advance.
#26285
Posted: 09/04/2013 01:36:49
by Eugene Mayevski (EldoS Corp.)

Use PostMessage method in MCMessenger class to broadcast a message via UDP . Note, that you need to send it to special address 255.255.255.255 . Note, that broadcast IP messages don't pass gates, NATs, routers etc. They are sent only within one network segment.

Please refer to SendNote sample to see how messages are sent and received. The principle is absolutely the same for UDP and Socket (TCP) transports


Sincerely yours
Eugene Mayevski
#26290
Posted: 09/04/2013 04:28:56
by luols (Basic support level)
Joined: 09/03/2013
Posts: 4

Thank Eugene Mayevski's reply, my code below, but cannot receive the broadcast message, or the code below has any questions?

MCMessage message = MCMessenger.CreateMessageFromText((int)CmdServer.SendQuestion, 0, 0, "this is broadcast message", Encoding.UTF8, true);
string Dest = string.Format("UDP:{0}|SendNote", "255.255.255.255:1459");
mcMessenger.PostMessage(Dest, message, null);
#26291
Posted: 09/04/2013 04:47:44
by Eugene Mayevski (EldoS Corp.)

Check if you can send the message using "regular" delivery, i.e. not broadcast. Once that works, you can investigate broadcasting.


Sincerely yours
Eugene Mayevski
#26313
Posted: 09/04/2013 19:44:39
by luols (Basic support level)
Joined: 09/03/2013
Posts: 4

When i use SocketTransport, the message can be sent and received normally.
#26316
Posted: 09/05/2013 02:25:07
by Eugene Mayevski (EldoS Corp.)

Ok, now move to UDP delivery (not broadcast, but using SendMessage and PostMessage) - do they work ?

UDP doesn't guarantee delivery so on busy networks packets can be lost. Also there's a limit on the packet size. For end-to-end delivery it's about 64K but for broadcasts it's 1520 bytes if memory serves.


Sincerely yours
Eugene Mayevski
#26396
Posted: 09/11/2013 22:09:53
by luols (Basic support level)
Joined: 09/03/2013
Posts: 4

Quote
Eugene Mayevski wrote:
Ok, now move to UDP delivery (not broadcast, but using SendMessage and PostMessage) - do they work ?

UDP doesn't guarantee delivery so on busy networks packets can be lost. Also there's a limit on the packet size. For end-to-end delivery it's about 64K but for broadcasts it's 1520 bytes if memory serves.


My problem has been solved!
thank you!
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

Topic viewed 4794 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!