473,569 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with JoinMulticastGr oup 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.JoinMult icastGroup(IPAd dress.Parse("22 4.100.0.1"));
Console.WriteLi ne("Waiting.... .");
IPEndPoint iep = new IPEndPoint(IPAd dress.Any, 0);
byte[] data = client.Receive( ref iep);
string stringData = Encoding.ASCII. GetString(data, 0,data.Length);
Console.WriteLi ne("received: {0}", stringData);
client.Close();
}
}

My Sender Class
*************** ***
class UdpSender
{
public static void Main()
{
UdpClient sender = new UdpClient();
IPEndPoint iep = new
IPEndPoint(IPAd dress.Parse("22 4.100.0.1"),105 00);
byte[] data = Encoding.ASCII. GetBytes("This is a test message");
sender.Send(dat a, 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 3544
fh@energotec.de (Frank an der Heiden) wrote in message news:<22******* *************** ****@posting.go ogle.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(IPAd dress.Parse("22 4.100.0.1"),105 00);
byte[] data = Encoding.ASCII. GetBytes("This is a test message");
sender.Send(dat a, 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(IPAd dress.Parse("lo calLANIP"),
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(IPAd dress.Parse("lo calLANIP"),
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
1420
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 Socket and begin a normal communication; I mean, I want to automatically initialize
3
2997
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 additional init string of the modem (for instance if the modem does not detect the dial tone). So, how do I do this?
7
1463
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
1541
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 close the connection by calling the RasHangUp API: in this case i can redial the number and open a new connection. The problem comes out when the...
1
1284
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
1076
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 the connection details to the modem log file (Modemlog.txt )?
1
1643
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 modem. After establishing the connection I am getting a message like "Enter numeric message after beep". 1) How can I find whether connection is...
1
15206
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 can no longer connect to the domain controller. Ping resolves the domain controllers name to the correct ip nslookup finds the ip but can not resolve...
17
5548
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 in that chapter and create a socket connection between my desktop and laptop. However, these two computers are already connected on my home network...
0
8132
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7982
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...
0
6286
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
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...
0
5222
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...
0
3656
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...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
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
1
1226
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.