Hello,
I'm having trouble with the JoinMulticastin gGroup function with C#
..NET and the Compact Framework. My console application on my PocketPC
has to listen for any datagrams coming from the network, by UDP
protocol. Here is a sample of my code :
public class UDPMulticastLis tener
{
private static readonly IPAddress GroupAddress =
IPAddress.Parse ("127.0.0.1" );
private const int GroupPort = 9000;
private static void StartListener()
{
bool done = false;
UdpClient listener = new UdpClient();
IPEndPoint groupEP = new IPEndPoint(Grou pAddress, GroupPort);
try
{
listener.JoinMu lticastGroup(Gr oupAddress, 50);
listener.Connec t(groupEP);
while (!done)
{
Console.WriteLi ne("Waiting for broadcast");
byte[] bytes = listener.Receiv e(ref groupEP);
Console.WriteLi ne("Received broadcast from {0} :\n {1}\n",
groupEP.ToStrin g(),
Encoding.ASCII. GetString(bytes , 0, bytes.Length));
}
listener.Close( );
}
catch (SocketExceptio n e)
{
Console.WriteLi ne(e.toString() );
Console.ReadLin e();
}
}
public static int Main(String[] args)
{
StartListener() ;
return 0;
}
}
I'm having this message : System.Net.Sock ets.SocketExcep tion:An
invalid argument was supplied
I've put the address "127.0.0.1" because I want the application to
catch any datagram comming from the network, so it has to work
localhost. For what I've read from the msdn, the range has to be
between 224.0.0.0 and 239.255.255.255 . But if I specify and address in
this range, I have the same message.
Instead of posting "e.toString ()", if I post "e.ErrorCode()" , I
receive the error code 10022, but I have absolutely no idea what it
means, and I didn't find any much help on that matter on the msdn.
Thanks in advance for the help you could give me... 1 2009
I think you may need to remove Connect command. See http://groups.google.co.uk/groups?hl...3DN%26tab%3Dwg
for a useful discussion on IP multicasting.
Couple of other minor points. I would suggest creating the UdpCLient object
in a using block, as if your code encounters an exception, the UdpClient
object will not be disposed. Also, cannot see where done is set to true to
allow loop to break.
Of course, this could just be demo code, in whichc ase ignore me!
HTH
Dan
"Ben" wrote: Hello,
I'm having trouble with the JoinMulticastin gGroup function with C# ..NET and the Compact Framework. My console application on my PocketPC has to listen for any datagrams coming from the network, by UDP protocol. Here is a sample of my code :
public class UDPMulticastLis tener { private static readonly IPAddress GroupAddress = IPAddress.Parse ("127.0.0.1" ); private const int GroupPort = 9000;
private static void StartListener() { bool done = false;
UdpClient listener = new UdpClient(); IPEndPoint groupEP = new IPEndPoint(Grou pAddress, GroupPort);
try { listener.JoinMu lticastGroup(Gr oupAddress, 50); listener.Connec t(groupEP);
while (!done) { Console.WriteLi ne("Waiting for broadcast"); byte[] bytes = listener.Receiv e(ref groupEP);
Console.WriteLi ne("Received broadcast from {0} :\n {1}\n", groupEP.ToStrin g(), Encoding.ASCII. GetString(bytes , 0, bytes.Length)); }
listener.Close( );
} catch (SocketExceptio n e) { Console.WriteLi ne(e.toString() ); Console.ReadLin e(); } }
public static int Main(String[] args) { StartListener() ;
return 0; } }
I'm having this message : System.Net.Sock ets.SocketExcep tion:An invalid argument was supplied
I've put the address "127.0.0.1" because I want the application to catch any datagram comming from the network, so it has to work localhost. For what I've read from the msdn, the range has to be between 224.0.0.0 and 239.255.255.255 . But if I specify and address in this range, I have the same message.
Instead of posting "e.toString ()", if I post "e.ErrorCode()" , I receive the error code 10022, but I have absolutely no idea what it means, and I didn't find any much help on that matter on the msdn.
Thanks in advance for the help you could give me... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Asad Khan |
last post by:
Hi, I have Visual Studio 2002 Enterprise Architecture Edition. I was
wondering if anyone has any information on how I can develop applications
for .Net Compact Framework using this IDE. I've heard Visual Studio 2003
ships with the functionality for .Net Compact Framework development. But
right now I have Visual Studio 2002. Is there anything I can do? (Other than
the obvious upgrade to 2003).
I've heard some beta version of .Net Compact...
|
by: Ioannis Vranos |
last post by:
Is there any way to develop .net compact framework applications from within
VS 2003? There isn't such an option in the new project options.
|
by: carmen |
last post by:
I was try an example about "manipulating graphical objects" in a windows CE
system and I get an error because "Matrix" cann't be found in the compact
framework. Is it true or perhaps there are another problems?
Thank you
carmen
|
by: Ben |
last post by:
Hello,
I'm having trouble with the JoinMulticastingGroup function with C#
..NET and the Compact Framework. My console application on my PocketPC
has to listen for any datagrams coming from the network, by UDP
protocol. Here is a sample of my code :
public class UDPMulticastListener
{
private static readonly IPAddress GroupAddress =
|
by: Martin Robins |
last post by:
Can somebody please confirm my suspicion; I have been presented with a
Windows CE.NET 4.2 device (not PocketPC) and have been asked to develop an
application using Vusiau Studio 2005 and Compact Framework 2.0 - I cannot
find any compatibility between this as there only seems to be support for
CF2 on PocketPC/2003 and CE.NET 5
I have also tried loading the compact framework installers onto the device
and this fails with both versions!
...
| |
by: shaiamiel |
last post by:
Hello,
Im looking for a VOIP SDK that will be appliciable to both PC & Pocket
PCs using the .net framework & c#.
Does anyone know such thing? I tried bear soft's SDK but it didnt work
so well (their code example in c# compile but didnt function
propertly..)
Thanks,
|
by: The Mad Ape |
last post by:
Hi experts.
I am using VB.Net 2005 as my development environment.
I have created an application for the Pocket PC. The data is
transferred to the desktop via OpenNETCF and then I use SQL Compact
Server 2005 to process the data on the desktop with a final export to
Access format.
I have Crystal Reports XI and my VB.Net 2005 is also bundled with CR
|
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...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |