473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cannot receive Multicast package

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.

The question is :
B can receive multicast sent from A, A cannot receive the package from B
(A can receive multicast package from itself)
If disable the internet network card on A, A can receive multicast
package from B.

Would you please give me some advise on this issue.

Thanks ,

Phlics.
Nov 15 '05 #1
6 6452
"PHLICS_Admin" <ph****@hotmail.com> wrote in message news:<O3**************@TK2MSFTNGP09.phx.gbl>...
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.

The question is :
B can receive multicast sent from A, A cannot receive the package from B
(A can receive multicast package from itself)
If disable the internet network card on A, A can receive multicast
package from B.

Phlics -

When you have more than one network card in a computer, you should
specify which card you want to receive multicast messages on in your
socket constructor, otherwise the socket will choose one for itself
(which may or may not be a good thing).

If you are using a UdpClient object, this would look like:

IPEndPoint iep = new IPEndPoint(IPAddress.Parse("192.168.0.1"),
9050);
UdpClient sock = new UdpClient(iep);
sock.JoinMulticastGroup(IPAddress.Parse("224.100.0 .1"));

If you are using a Socket object, it would look like this:

Socket sock = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram,
ProtocolType.Udp);
IPEndPoint iep = new IPEndPoint(IPAddress.Parse("192.168.0.1"),
9050);
sock.Bind(iep);
sock.SetSocketOption(SocketLevel.IP,
SocketOptionName.AddMembership,
new
MulticastOption(IPAddress.Parse("224.100.0.1")));
As a side note, if you want to receive multicast packets on both
interfaces, you can use the IPAddress.Any value for the IPEndPoint
constructor. Hope this helps solve your problem.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html
Nov 15 '05 #2
Thanks , but it does not work.

Other information:
If I switch the network cards(change the card used for internet to
intranet ...), it works .

Regards,
"Rich Blum" <ri*******@juno.com> wrote in message
news:cc*************************@posting.google.co m...
"PHLICS_Admin" <ph****@hotmail.com> wrote in message

news:<O3**************@TK2MSFTNGP09.phx.gbl>...
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.

The question is :
B can receive multicast sent from A, A cannot receive the package from B (A can receive multicast package from itself)
If disable the internet network card on A, A can receive multicast
package from B.

Phlics -

When you have more than one network card in a computer, you should
specify which card you want to receive multicast messages on in your
socket constructor, otherwise the socket will choose one for itself
(which may or may not be a good thing).

If you are using a UdpClient object, this would look like:

IPEndPoint iep = new IPEndPoint(IPAddress.Parse("192.168.0.1"),
9050);
UdpClient sock = new UdpClient(iep);
sock.JoinMulticastGroup(IPAddress.Parse("224.100.0 .1"));

If you are using a Socket object, it would look like this:

Socket sock = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram,
ProtocolType.Udp);
IPEndPoint iep = new IPEndPoint(IPAddress.Parse("192.168.0.1"),
9050);
sock.Bind(iep);
sock.SetSocketOption(SocketLevel.IP,
SocketOptionName.AddMembership,
new
MulticastOption(IPAddress.Parse("224.100.0.1")));
As a side note, if you want to receive multicast packets on both
interfaces, you can use the IPAddress.Any value for the IPEndPoint
constructor. Hope this helps solve your problem.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html

Nov 15 '05 #3
Following code snip is used :

this._clsMCastReceiver = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
IPEndPoint ipep=new IPEndPoint(IPAddress.Any , CIMSys.MCastPort);
this._clsMCastReceiver.Bind(ipep);
IPAddress ip=IPAddress.Parse(CIMSys.MCastIPAddress);

this._clsMCastReceiver.SetSocketOption(SocketOptio nLevel.IP,
SocketOptionName.AddMembership, new MulticastOption(ip , IPAddress.Any));

When I disable the internet network card , it works correctly.

Please give me advise on it .

Thanks,

Phlics.

"Rich Blum" <ri*******@juno.com> wrote in message
news:cc*************************@posting.google.co m...
"PHLICS_Admin" <ph****@hotmail.com> wrote in message

news:<O3**************@TK2MSFTNGP09.phx.gbl>...
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.

The question is :
B can receive multicast sent from A, A cannot receive the package from B (A can receive multicast package from itself)
If disable the internet network card on A, A can receive multicast
package from B.

Phlics -

When you have more than one network card in a computer, you should
specify which card you want to receive multicast messages on in your
socket constructor, otherwise the socket will choose one for itself
(which may or may not be a good thing).

If you are using a UdpClient object, this would look like:

IPEndPoint iep = new IPEndPoint(IPAddress.Parse("192.168.0.1"),
9050);
UdpClient sock = new UdpClient(iep);
sock.JoinMulticastGroup(IPAddress.Parse("224.100.0 .1"));

If you are using a Socket object, it would look like this:

Socket sock = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram,
ProtocolType.Udp);
IPEndPoint iep = new IPEndPoint(IPAddress.Parse("192.168.0.1"),
9050);
sock.Bind(iep);
sock.SetSocketOption(SocketLevel.IP,
SocketOptionName.AddMembership,
new
MulticastOption(IPAddress.Parse("224.100.0.1")));
As a side note, if you want to receive multicast packets on both
interfaces, you can use the IPAddress.Any value for the IPEndPoint
constructor. Hope this helps solve your problem.

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html

Nov 15 '05 #4
"PHLICS_Admin" <ph****@hotmail.com> wrote in message news:<OD**************@TK2MSFTNGP12.phx.gbl>...
this._clsMCastReceiver.SetSocketOption(SocketOptio nLevel.IP,
SocketOptionName.AddMembership, new MulticastOption(ip , IPAddress.Any));

When I disable the internet network card , it works correctly.

Phlics -

Have you tried using the MulticastOption constructor that only
uses the multicast IP address, and not the local IP address?
Alternatively, have you tried specifying just the proper network card
IP address as the local address?

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html
Nov 15 '05 #5
I have tried , but it does not work .

There are two network card on the computer. If disable the network card
(which connect to internet) , it works .

Thanks,

"Rich Blum" <ri*******@juno.com> wrote in message
news:cc**************************@posting.google.c om...
"PHLICS_Admin" <ph****@hotmail.com> wrote in message

news:<OD**************@TK2MSFTNGP12.phx.gbl>...
this._clsMCastReceiver.SetSocketOption(SocketOptio nLevel.IP,
SocketOptionName.AddMembership, new MulticastOption(ip , IPAddress.Any));
When I disable the internet network card , it works correctly.

Phlics -

Have you tried using the MulticastOption constructor that only
uses the multicast IP address, and not the local IP address?
Alternatively, have you tried specifying just the proper network card
IP address as the local address?

Rich Blum - Author
"C# Network Programming" (Sybex)
http://www.sybex.com/sybexbooks.nsf/Booklist/4176
"Network Performance Open Source Toolkit" (Wiley)
http://www.wiley.com/WileyCDA/WileyT...471433012.html

Nov 15 '05 #6
Following code snip is used :

this._clsMCastReceiver = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
IPEndPoint ipep=new IPEndPoint(IPAddress.Any , CIMSys.MCastPort);
this._clsMCastReceiver.Bind(ipep);
IPAddress ip=IPAddress.Parse(CIMSys.MCastIPAddress);

this._clsMCastReceiver.SetSocketOption(SocketOptio nLevel.IP,
SocketOptionName.AddMembership, new MulticastOption(ip , IPAddress.Any));

When I disable the internet network card , it works correctly.

Please give me advise on it .

Thanks,

Phlics.

"PHLICS_Admin" <ph****@hotmail.com> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
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.

The question is :
B can receive multicast sent from A, A cannot receive the package from B (A can receive multicast package from itself)
If disable the internet network card on A, A can receive multicast
package from B.

Would you please give me some advise on this issue.

Thanks ,

Phlics.

Nov 15 '05 #7

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

Similar topics

1
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...
7
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...
1
by: Dan Kelley | last post by:
I am writing a server component that will raise various "events" using UDP multicast events. A number of winform clients will begin receiving these events on a background thread, listening on the...
2
by: Terry | last post by:
I've got a strange problem receiving multicast packets in a C# application. What's strange is that it works *sometimes* but not always. I create a socket, call bind(), set the multicast socket...
0
by: Nuno Magalhaes | last post by:
I've build an application that sends UDP packets to a multicast address 224.1.2.3 but in my other application I can't receive that packets using the code below. It blocks on receive. Any...
3
by: greenxiar | last post by:
My Computer is Win2K3 R2, Code is: using System; using System.Net; using System.Net.Sockets; using System.Threading; namespace TechUDPBroadcast { class Program { static void Main(string...
2
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. ...
5
by: AliRezaGoogle | last post by:
Hi, I have a conceptual question on Events and Multicast Delegates. Let me explain: As we know an event is a multicast delegate. What we declare as an event is inherently a multicast delegate....
0
by: Stodge | last post by:
I'm trying to get a simple multicast application working using Twisted; so far I have: from twisted.internet.protocol import DatagramProtocol from twisted.internet import reactor from...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.