473,320 Members | 1,914 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,320 software developers and data experts.

MS .NET VS C++ and Socket Class doing Raw IP ReceiveFrom

I'm using MS VS C++ .NET. I've written a multicast test utility that can
send IGMP packets for a user specified group address. As well, it can
send and receive UDP packets for a specified multicast group. I'm using
the Sockets Class methods for sending and receiving packets. One area I'm having problems with is recieving IGMP packets on the Raw IP socket.

Here is the main calls I am using to receive IGMP packets.
Expand|Select|Wrap|Line Numbers
  1.     s = new Socket(AddressFamily::InterNetwork, SocketType::Raw, 
  2.                             ProtocolType::Igmp);
  3.     s->SetSocketOption(SocketOptionLevel::IP, 
  4.                                   SocketOptionName::MulticastInterface, 0);
  5.     s->Bind(new IPEndPoint(IPAddress::Any,0));
  6.  
  7.     IPEndPoint* sender = new IPEndPoint(IPAddress->Any, 0);
  8.     EndPoint* tempRemoteEP = __try_cast<EndPoint*>(sender);
  9.     Byte buffer[] = new Byte[1024];
  10.     Console::WriteLine(S"Waiting on socket.");
  11.     s->ReceiveFrom(buffer, 0, 1024, SocketFlags::None, &tempRemoteEP);
  12.  
I see the debug WriteLine I put in that it is waiting on the socket. I'm using Wireshark to watch for IGMP Queries/Reports on the wire and see IGMP
messaging, but my test module is not receiving these. I've tried various
other Socket Options, etc. and haven't had any success. I've read some
info on Bind that a 0 causes Bind to generate a enphemoral port number.
Since I'm trying to do Raw IP do I bind or do I need some value other than
0 for bind? I haven't been able to find any examples or info anywhere on
the Web and I've fallin into the mode of just trying various options from
the Socket Class. Kinda like rolling dice. Any one have any experience
in setting up to receive Raw IP with MS VC++?
May 14 '07 #1
1 2657
This is an update to my post for information:
I found reference to the Socket.I0Control() function that allows a code
as a parameter. One of the codes I found reference to at the MSDN
URL : <http://msdn2.microsoft.com/en-us/library/system.net.sockets.iocontrolcode.aspx>.
This identifies an IOControlCode of ReceiveAllIgmpMulticast.
However I get a compile error of not a class of namespace on IOControlCode.
May 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dan Rice | last post by:
Hello, Im trying to get the following working but it doesn't seem to receive anything. I have got the UdpClient class to receive data but unreliably and was told to use the Socket class...
3
by: Stephan Steiner | last post by:
Hi I have a small program listening to UDP broadcast datagrams that are periodically sent out. It will stop listening for a certain period if either a sufficient number of packets has been...
1
by: Rolln_Thndr | last post by:
I'm vey new to network programing and have a few rather fundemental questions. I'm creating a very basic UDP proxy server and having a few issues regarding the sockets. Is it possible to change...
2
by: Richy Rich | last post by:
Hi, I've developed an application in C# which spawns a thread to receive datagrams. If I use the socket receive method, there are no problems when using the application under NT or XP. I...
5
by: Terry | last post by:
It's my understanding of UDP sockets that if there is a thread blocked on a "recvFrom()" call and other thread sends a UDP packet to some address, that if the machine on the other end isn't up,...
10
by: Jim H | last post by:
I have a UDP socket that sends out a request on a multicast socket and waits for a response. This client is not listening on a multicast IP but the local IP. The server (UNIX) responds to the...
0
by: Ron L | last post by:
I am trying to write a program that will open a UDPClient and listen on it. I have based my code on the example at MS in the "UDPClient.Receive Method (.NET Framework)" file, but when I try to call...
1
by: Nuno Magalhaes | last post by:
Does the function below returns an UDP packet, for example, from the local machine? Why does it give me an error: "The best overloaded method match for ReceiveFrom... has some invalid arguments"....
0
by: Johan | last post by:
Why is the parameter remoteEP of the function Socket.ReceiveFrom() a ref parameter and not an out parameter? http://msdn2.microsoft.com/en-us/library/wdfskwcy.aspx public int ReceiveFrom (...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.