473,662 Members | 2,596 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UDP Multicast losing messages

Hi,

I'm trying to send a large number of messages to a UDP multicast group
with which I have one client subscribed. But I'm losing mesages, and
I'm not entirely sure why. I can't seem to find the reason, the asynch
receive on the client doesn't even get called the corect number of
times, which is 1000. I'm trying to send 1000 messages via an asynch
call to sendto.

the connect code for the send

lock (_lock)
{
if (_socketState ==
TSMultiCastEndP ointState.Conne cted) return true;

_socket = null;
_socket = new Socket(AddressF amily.InterNetw ork,
SocketType.Dgra m, ProtocolType.Ud p);
_remoteEP = new IPEndPoint(_rem oteIP, _port);
_localEP = new IPEndPoint(_loc alIP, _port);

_socket.SetSock etOption(Socket OptionLevel.Soc ket,
SocketOptionNam e.ReuseAddress, 1);

_socket.Bind(_l ocalEP);

connectSuccessf ul = true;

_socketState = TSMultiCastEndP ointState.Conne cted;
}

other then that I just call sendTo 1000 times in a for loop, and the
receive on the client only pops maybe 300 times. Anyone have any
ideas? The receiveCallback code won't really help because it doesn't
even get called 1000 times.

Jan 3 '07 #1
7 3556
"DaTurk" <mm******@hotma il.comwrote in message
news:11******** *************@s 34g2000cwa.goog legroups.com...
Hi,

I'm trying to send a large number of messages to a UDP multicast group
with which I have one client subscribed. But I'm losing mesages, and
I'm not entirely sure why.
UDP is not reliable. There is no guarantee that if you send 1000 datagrams,
each recipient will receive 1000 datagrams.

There's a bunch of other stuff UDP doesn't guarantee either. You really
need to study the basic rules for UDP before you start trying to use it.
Jan 4 '07 #2

Losing 70% of packets is a huge number, especially within a local lan
(I'm assuming OP is in a development environment within a local lan).

Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 3 Jan 2007 17:39:50 -0800, "Peter Duniho"
<Np*********@Nn OwSlPiAnMk.comw rote:
>"DaTurk" <mm******@hotma il.comwrote in message
news:11******* **************@ s34g2000cwa.goo glegroups.com.. .
>Hi,

I'm trying to send a large number of messages to a UDP multicast group
with which I have one client subscribed. But I'm losing mesages, and
I'm not entirely sure why.

UDP is not reliable. There is no guarantee that if you send 1000 datagrams,
each recipient will receive 1000 datagrams.

There's a bunch of other stuff UDP doesn't guarantee either. You really
need to study the basic rules for UDP before you start trying to use it.
Jan 4 '07 #3

Peter Duniho wrote:
"DaTurk" <mm******@hotma il.comwrote in message
news:11******** *************@s 34g2000cwa.goog legroups.com...
Hi,

I'm trying to send a large number of messages to a UDP multicast group
with which I have one client subscribed. But I'm losing mesages, and
I'm not entirely sure why.

UDP is not reliable. There is no guarantee that if you send 1000 datagrams,
each recipient will receive 1000 datagrams.

There's a bunch of other stuff UDP doesn't guarantee either. You really
need to study the basic rules for UDP before you start trying to use it.
I do understand UDP. Been using it for years, but like Mr. Neff said
losing 70% is a very large percentage. THere has to be something else
going on.

I've tried running the sender / receiver on the same box, and on
different boxs, but with the same results. It seems that it can do 100
messages fine, but anything larger, say 125 encounters some loss. What
really worried me is that the Asynch receive callback is not even
receiving anything.

That's why I think it has something to do with the way the sockets have
been set up. I tried sending the messages synch, and asynch with the
only change being that using asynch, more message were received.

Does anyone have any other ideas besides condescending to me about UDP

Jan 4 '07 #4
"DaTurk" <mm******@hotma il.comwrote in message
news:11******** **************@ v33g2000cwv.goo glegroups.com.. .
Does anyone have any other ideas besides condescending to me about UDP
It's not condescension. It's simply being realistic. Too many people show
up here asking about sockets without really having made any effort to learn
the fundamentals to assume you are different when you're not clear about
your problem. You said "But I'm losing mesages, and
I'm not entirely sure why". Nothing in that statement suggests that you
have any idea that it's natural to lose messages while using UDP, and in
fact it strongly suggests otherwise.

I agree that 70% is a large number to lose, but it's not impossible. That
said, sure...you might have a bug in your own code. Since you're so
experienced with UDP, you're obviously aware of the diagnostic tools that
you can use to narrow down where the data is being lost. That would be the
first thing I'd do...until you know where the problem is, you can't hope to
fix it.

In addition to ruling out actual network problems, you are also mistaken to
assume that the receive code itself isn't faulty. Failing to keep up with
the inbound data is one easy way to lose lots of UDP datagrams. At this
point, you have not posted any information that narrows the problem down one
bit.

You either need to post *all* of the code involved and hope someone is
generous enough to read through it all and see if there's a bug, or you need
to do enough diagnostics to narrow the problem down enough so that you can
post the exact subset of the code that you *know* is causing the problem.

Pete
Jan 4 '07 #5
Wow, touchy touchy. Look, I have analyzed my traffic, and do see that
everything is getting sent across. Stating that "I'm not entirely sure
why" doesn't suggest I don't know how to use UDP. It suggests that I
don't know why I'm losing messages, and that's all. If you want to
assume that I'm daft, that's your choice. At any rate, I've found my
problem, but I do appreciate your help. In the very least you've
helped me to become a better person.

Peter Duniho wrote:
"DaTurk" <mm******@hotma il.comwrote in message
news:11******** **************@ v33g2000cwv.goo glegroups.com.. .
Does anyone have any other ideas besides condescending to me about UDP

It's not condescension. It's simply being realistic. Too many people show
up here asking about sockets without really having made any effort to learn
the fundamentals to assume you are different when you're not clear about
your problem. You said "But I'm losing mesages, and
I'm not entirely sure why". Nothing in that statement suggests that you
have any idea that it's natural to lose messages while using UDP, and in
fact it strongly suggests otherwise.

I agree that 70% is a large number to lose, but it's not impossible. That
said, sure...you might have a bug in your own code. Since you're so
experienced with UDP, you're obviously aware of the diagnostic tools that
you can use to narrow down where the data is being lost. That would be the
first thing I'd do...until you know where the problem is, you can't hope to
fix it.

In addition to ruling out actual network problems, you are also mistaken to
assume that the receive code itself isn't faulty. Failing to keep up with
the inbound data is one easy way to lose lots of UDP datagrams. At this
point, you have not posted any information that narrows the problem down one
bit.

You either need to post *all* of the code involved and hope someone is
generous enough to read through it all and see if there's a bug, or you need
to do enough diagnostics to narrow the problem down enough so that you can
post the exact subset of the code that you *know* is causing the problem.

Pete
Jan 4 '07 #6
"DaTurk" <mm******@hotma il.comwrote in message
news:11******** **************@ 42g2000cwt.goog legroups.com...
Wow, touchy touchy.
I'm not touchy. I'm simply trying to explain why YOU shouldn't be touchy.
Who told you to assume I was being condescending? I didn't (and even if I
did, why should you listen to me?).
Look, I have analyzed my traffic, and do see that
everything is getting sent across.
So it *is* a problem with your receiving code, even though you said you knew
it wasn't.
Stating that "I'm not entirely sure
why" doesn't suggest I don't know how to use UDP. It suggests that I
don't know why I'm losing messages, and that's all.
The most common reason for someone to not know why they are losing UDP
datagrams is that they don't understand UDP. You didn't write anything to
suggest otherwise, so the safe assumption was that you don't understand UDP.
If you do, that's great. But you didn't write anything to start with to
suggest you do, and you *did* write something that suggested you don't.

Again, I had no control over what you wrote in your initial post (or any
subsequent one for that matter). I can't help that your post was ambiguous
and led to incorrect assumptions. When you provide incomplete information,
we are forced to either make assumptions or simply not answer. I suppose
not answering is a valid option, but it doesn't make for much forward
progress. Personally, I prefer to make assumptions and try to get a problem
solved in the process.
If you want to
assume that I'm daft, that's your choice.
I prefer the word "inexperienced" . Many people fail to understand UDP
without being "daft". But again, if you want to be touchy about it, I
suppose that's your right. Just remember, it's *you* being touchy, not me.
At any rate, I've found my
problem, but I do appreciate your help. In the very least you've
helped me to become a better person.
If you found your problem, why did you not post the resolution here?
There's more to having a newsgroup than just getting people to tell you what
your problems are. By sharing your solution, you may help someone with the
same problem in the future.

Pete
Jan 4 '07 #7
Your right, my apologies. I was wrong in assuming the problem was not
in the receive method. I assumed that because the method wasn't being
hit there was an issue ealier on.

SO the problem was that the Receive method wasn't reacting quick enough
I was using several libraries that I built previously to deal with TCP.
They would have worked fine, but they needed to be stream lined a bit
more to be viable in a UDP world. SO I'm in the process of optimizing
them now. Specifically, my method to detach my header from the front
of the byte array was a bit more cumbersome then it needed to be. I
was truncating the front of the received byte array, and manually
deserializing it to get the info in the header.

WHich is quick, but the truncating of the original byte array had alot
of overhead as it created new memory twice, once for the header byte
array, and a second time for the newly truncated original message. Now
it passes the original byte array to the Header struct to be
deserialized, but isn't truncated. The header struct just bitConverts
what it needs.

And Peter, even though you may not mean too, you come off
condescending.

Peter Duniho wrote:
"DaTurk" <mm******@hotma il.comwrote in message
news:11******** **************@ 42g2000cwt.goog legroups.com...
Wow, touchy touchy.

I'm not touchy. I'm simply trying to explain why YOU shouldn't be touchy.
Who told you to assume I was being condescending? I didn't (and even if I
did, why should you listen to me?).
Look, I have analyzed my traffic, and do see that
everything is getting sent across.

So it *is* a problem with your receiving code, even though you said you knew
it wasn't.
Stating that "I'm not entirely sure
why" doesn't suggest I don't know how to use UDP. It suggests that I
don't know why I'm losing messages, and that's all.

The most common reason for someone to not know why they are losing UDP
datagrams is that they don't understand UDP. You didn't write anything to
suggest otherwise, so the safe assumption was that you don't understand UDP.
If you do, that's great. But you didn't write anything to start with to
suggest you do, and you *did* write something that suggested you don't.

Again, I had no control over what you wrote in your initial post (or any
subsequent one for that matter). I can't help that your post was ambiguous
and led to incorrect assumptions. When you provide incomplete information,
we are forced to either make assumptions or simply not answer. I suppose
not answering is a valid option, but it doesn't make for much forward
progress. Personally, I prefer to make assumptions and try to get a problem
solved in the process.
If you want to
assume that I'm daft, that's your choice.

I prefer the word "inexperienced" . Many people fail to understand UDP
without being "daft". But again, if you want to be touchy about it, I
suppose that's your right. Just remember, it's *you* being touchy, not me.
At any rate, I've found my
problem, but I do appreciate your help. In the very least you've
helped me to become a better person.

If you found your problem, why did you not post the resolution here?
There's more to having a newsgroup than just getting people to tell you what
your problems are. By sharing your solution, you may help someone with the
same problem in the future.

Pete
Jan 4 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1629
by: T.C.McQueen | last post by:
Does anyone know how to receive an ICMP-Router Advertisement Message using Raw/ICMP - Sockets in Multicast -Mode with .NET I tried it several times differently but it does not work I think it's impossible, because I cannot receive any data with the Receive- or the ReceiveFrom-Method withou losing the multicast-membership I hope that I am wrong Please help me ! ( Maybe with code snippets :-) )
1
3342
by: Alfred B. Thordarson | last post by:
Hi All. I have this weird problem that on my devlepment machine (Windows XP) I don't receive MultiCast messages that I send from my machine. This means that my two processes can't communicate using MultiCast if they both run on the same machine. I have created a small MultiCast "server" which is listening for messages on 224.100.0.1:8932 and then a small MultiCast "client" that sends out messages to this same address and port. The two...
6
6498
by: PHLICS_Admin | last post by:
Hi All, There are two network cards in one computer (named A) , and there is one network card in another computer(named B). On computer A: one network card is used to connect to internet, and the other network card is used in intranet whose ipaddress is 192.168.0.1 On computer B: the network card's ipaddress is 192.168.0.2. These two computer can connect to each other.
7
7703
by: Jim H | last post by:
Is there something special I need to do to send data to a multicast IP and have it go across a router? Router is a Win2000 Server connecting 2 networks via RRAS PPTP. The routing appears to be working because I can ping the multicast address and get responses from the server on the other network. I didn't think ping would work like that but as long as I have the server process running I can ping the multicast IP and get a response. The...
2
2109
by: Naveen Mukkelli | last post by:
Hi, I'm sending multicast messages UDP socket and C#. But the receiving clients are not receiving all the messages. Receiving clients are missing out some messages. When I debug the server side, the messages are being sent correctly, but receiving side side is missingout some messages. What could be the problem and how can we solve this problem.
1
280
by: Naveen Mukkelli | last post by:
Hi, When I run 2 or more clients on the same machine, the first client application is receiving multicast messages but not the subsequent clients. I'm using the same, multicast address and port for all the clients as this is the default multicast ip, all the clients automatically register to this ip and port number.
1
4813
by: Eric St-Onge | last post by:
Hi, I have eleven C# applications running on eleven different computers sending packets to a MSMQ MultiCast configured queue (same address for all). Those eleven senders also act as receivers. Do all receivers receive the sent packets in the same order? Thanks Eric
7
8449
by: pietro.cerutti | last post by:
Hi guys, I have a daemon running on Debian and listening for multicast packets sent to 224.0.0.251:5353 (ZeroConf Multicast DNS queries). The server is plugged into a VLAN trunk with eth0 and joins several VLANs using virtual interfaces (i.e. eth0.xxx). It should be able to capture the UDP packets on any interfaces, so it spawns a thread for each interface specified in a config file, and for each thread it creates a socket: ...
2
3599
by: rodrigofsilva | last post by:
Dear, by chance somebody already got to send and to receive files for protocol Multicast in C #. I am to send messages and to receive messages but files are not getting. In case somebody has already done. Thank you
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.