473,508 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MultiCast send and receive on same XP machine?

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 work well
(the server displays the messages sent by the client) if the two are
running on separate machines.

However, if I run them both on my development machine the server
receives nothing? What am I missing? Your input would be highly
appreciated as I don't seem to be able to crack this one.

The important part of the listening "server" is:

---
IPAddress multiCastAddress = IPAddress.Parse("224.100.0.1");
int multiCastPort = 8932;

IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress localMultiCastAddress=ipHostInfo.AddressList[0];

IPEndPoint localMultiCastPoint = new IPEndPoint(localMultiCastAddress,
multiCastPort);

multiCastSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);

multiCastSocket.SetSocketOption(SocketOptionLevel. Socket,
SocketOptionName.ReuseAddress,1);

multiCastSocket.Bind(localMultiCastPoint);

MulticastOption multicastOption = new
MulticastOption(multiCastAddress,

localMultiCastAddress);

multiCastSocket.SetSocketOption(SocketOptionLevel. IP,
SocketOptionName.AddMembership,
multicastOption);

multiCastSocket.BeginReceive(buffer, 0, 10240, 0,
new
AsyncCallback(Server.MessageReceived),
null);
---

The important part of the sending "client" is:

---
IPAddress multiCastAddress = IPAddress.Parse("224.100.0.1");
int multiCastPort = 8932;

IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress localMultiCastAddress=ipHostInfo.AddressList[0];

multiCastSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram,
ProtocolType.Udp);

MulticastOption multicastOption = new
MulticastOption(multiCastAddress,
localMultiCastAddress);

multiCastSocket.SetSocketOption(SocketOptionLevel. IP,
SocketOptionName.AddMembership,
multicastOption);

IPEndPoint multiCastEndPoint = new
IPEndPoint(multiCastAddress,multiCastPort);

while(true)
{
string msg="Message at "+DateTime.Now.Ticks.ToString();
multiCastSocket.SendTo(Encoding.ASCII.GetBytes(msg ),multiCastEndPoint);
Console.WriteLine("Sent message ["+msg+"] to "+multiCastAddress
.ToString()+":"+multiCastPort+"...");
Thread.Sleep(1000);
}

---

When composing this message I tried running both on the same machine
(but now on a different XP machine - not on my development machine)
and it seems to work there (and my development machine receives the
messages as well). But still doesn't work if I run both on my
development machine. Wonder if this is a Windows XP configuration
problem?

I would really like your input on this – I'm completely stuck and I'm
sure you can help me with this.

-Alfred
Nov 15 '05 #1
1 3337
I don't think this is in my code because now I have tried the same
thing using the samples that come with Visual Studio .NET 2003 for
MultiCastOption and they work together on other machines as well as
between machines. But not even those samples work running together
both on my development machine.

This is some configuration on my machine. Do you have any thoughts on
what configuration that could be? I have been looking over the network
configuration and can't see a difference between my development
machine and the other machines that the two samples work on?!?

Looking forward to hearing from you.
Nov 15 '05 #2

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

Similar topics

0
1467
by: Richard L Rosenheim | last post by:
I'm playing around with setting up a multicast socket. I can create a socket for sending, and I can one that receives. Is it possible to create one socket that can do both? The code I've been...
6
6476
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...
2
530
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...
6
5624
by: Tom Kent | last post by:
I have a computer with two network cards (attached to seperate networks) and I am having trouble getting my C# application to send its multicast packets on a specific one. It receives just fine...
0
1341
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...
7
3550
by: DaTurk | last post by:
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...
0
1154
by: zig158 | last post by:
My application will use a multicast channel for contacting peers on the network running the application, like mDNS. I have some sample code that works great on my local machine, but have a question...
1
4148
by: Jayme.Pechan | last post by:
I was working on a multicast client and ran into a possible problem. Here is the code... udpClient = new UdpClient(4000); udpClient.JoinMulticastGroup(IPAddress.Parse("224.1.1.1"));...
1
1400
by: Ryuke | last post by:
I have a code that receives gps information from nodes and gives off its own coordinates via radios connected by Ethernet. but the code continues to run after receiving only 1 set of coordinates,...
0
7124
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
7498
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...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
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...
0
4707
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...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.