473,385 Members | 1,615 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.

Problem with JoinMulticastGroup and DFÜ Modem connection

Hi folks,

I have a problem with the following example:

################################################## ####

My Receiver Class
*****************
class UdpReceiver
{
public static void Main()
{
UdpClient client = new UdpClient(10500);
client.JoinMulticastGroup(IPAddress.Parse("224.100 .0.1"));
Console.WriteLine("Waiting.....");
IPEndPoint iep = new IPEndPoint(IPAddress.Any, 0);
byte[] data = client.Receive(ref iep);
string stringData = Encoding.ASCII.GetString(data, 0,data.Length);
Console.WriteLine("received: {0}", stringData);
client.Close();
}
}

My Sender Class
******************
class UdpSender
{
public static void Main()
{
UdpClient sender = new UdpClient();
IPEndPoint iep = new
IPEndPoint(IPAddress.Parse("224.100.0.1"),10500);
byte[] data = Encoding.ASCII.GetBytes("This is a test message");
sender.Send(data, data.Length, iep);
sender.Close();
}
}

##################################################

Generally everything works fine, when sending messages from my sender
to the receiver until I have only a connection in my LAN.
When additionally connecting the server to the Internet by modem (DFÜ),
then the sender receives NO message any longer.

I really tried many diferent combinations of ip-Adresses and ports etc,
"played" with my network-settings of my LAN and DFÜ, but nothing works.

It seems that the messages of the sender are routed in the internet, but how
can
I avoid this?

I found many examples how to establish an UDP-connection between
client and server and all work .... UNTIL my modem comes up!!

It's really frustrating, because meanwhile I have no more ideas what I could
try to fix this.

Any help or hint is more than welcome

Thanx in advance

Frank
Nov 15 '05 #1
2 3536
fh@energotec.de (Frank an der Heiden) wrote in message news:<22**************************@posting.google. com>...
I have a problem with the following example:

My Sender Class
******************
class UdpSender
{
public static void Main()
{
UdpClient sender = new UdpClient();
IPEndPoint iep = new
IPEndPoint(IPAddress.Parse("224.100.0.1"),10500);
byte[] data = Encoding.ASCII.GetBytes("This is a test message");
sender.Send(data, data.Length, iep);
sender.Close();
}
}

##################################################

Generally everything works fine, when sending messages from my sender
to the receiver until I have only a connection in my LAN.
When additionally connecting the server to the Internet by modem (DFÜ),
then the sender receives NO message any longer.

I really tried many diferent combinations of ip-Adresses and ports etc,
"played" with my network-settings of my LAN and DFÜ, but nothing works.

It seems that the messages of the sender are routed in the internet, but how
can
I avoid this?

Frank -

When you use the default UdpClient() constructor for your sender,
it will "assign the most appropriate local IP address and port number"
by default for the outgoing packets. Unfortunately for you what it
thinks is most appropriate is not what you think is most appropriate.

To avoid this you need to specify the IP address of your LAN
connection along with a default port number as an IPEndPoint object
within your UdpClient constructor:

IPEndPoint iep = new IPEndPoint(IPAddress.Parse("localLANIP"),
9050);
UdpClient sender = new UdpClient(iep);
....

This should force the UdpClient object to bind to the LAN
interface for your multicast messages instead of the modem interface.
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
> >
Frank -

When you use the default UdpClient() constructor for your sender,
it will "assign the most appropriate local IP address and port number"
by default for the outgoing packets. Unfortunately for you what it
thinks is most appropriate is not what you think is most appropriate.

To avoid this you need to specify the IP address of your LAN
connection along with a default port number as an IPEndPoint object
within your UdpClient constructor:

IPEndPoint iep = new IPEndPoint(IPAddress.Parse("localLANIP"),
9050);
UdpClient sender = new UdpClient(iep);
....

This should force the UdpClient object to bind to the LAN
interface for your multicast messages instead of the modem interface.
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

Yipiiiihhhh,

Now it works fine!
It was not so easy to obtain my specific Broadcast-Address for
the sender, because the software should run in different networks,
but also this works now!!

Thank You for your prompt reply, Rich!

Good Night
Frank
Nov 15 '05 #3

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

Similar topics

0
by: Dany | last post by:
Hi, everybody: How can I establish a connection using my modem in .NET? I want my application to initialize the modem, place a call and prepare all of the settings needed to create a TCP...
3
by: Clemens Chiba - Greentube I.E.S. AG | last post by:
Hi! If the user has no LAN connection I have to dialup to the internet in my application. This works fine, but in some case I'll have to change the phone number (if the provider changes) and the...
7
by: Just Me | last post by:
Sometimes I hear the MODEM dialing and I don't know why. Is there some way I can use VB to tell which program is causing it? I'm on a LAN so it may be a remote program. Thanks
0
by: yom | last post by:
Hi all. I am having some troubles with an application that has to open a dialup up connection. I am using the Ras API RasDial to call the remote modem an all works properly. I am also able to...
1
by: Trammel | last post by:
Anyone know how I would go about getting a CLID (Callers telephone number) from a normal 56k-flex modem (and if possible... without answering it using the modem) ?
0
by: gad | last post by:
I am dialing a modem with vs2005 .net 2.0. Connection between modems is ok but windows does not write the connection details in the modem log file. Why is that? How can i force windows to write...
1
by: vgonepudi | last post by:
Hi, Requirement: I want to send numeric message to pager. For that I have developed an application in VC++. My application takes pager number as input and dials that number through my local...
1
by: eblackmo | last post by:
I have a test network consisting of four servers running windows 2003 server R2 SP2. I have set up a domain which functioned correctly for about a day and a half until the other servers decided they...
17
by: John Salerno | last post by:
Let me see if this question even makes sense...I'm reading Core Python Programming and I jumped ahead to the more specific topics like network programming. I plan to follow along with the example...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.