473,404 Members | 2,178 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,404 software developers and data experts.

[C++] How to construct ICMP echo request

Hi guys,
It's my first time trying to create a packet in C++. So, what i have done so far are:
1. I have opened a packet level raw socket. Using this command:
sd = socket(PF_PACKET,SOCK_RAW,ETHERTYPE_IP) ;

2. I have gotten the interface number corresponding to interface name.
Using the command:
ioRtnCode = ioctl(sd,SIOCGIFINDEX,&ifioctl) ;

here, &ifioctl is supplied with eht1, in the ifrn_name from 0 to 4.

3. I have also created the address structure used for a packet socket. This address will be loaded in the frame.

So, my next step is to create the ICMP itself. How should I do this ? I mean, is there a special function or library to do so ? or should i just start from an array ?

Of course, this ICMP message later on will be framed to IP and to Ethernet.

Thanks,
Feb 27 '09 #1
0 3499

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

Similar topics

13
by: Bob Rivers | last post by:
Hi, I was doing a research looking for Java solutions that are able to do "ping". I found old messages (and not so old ones), telling that Java was not able to do that, because the API...
0
by: Andreas Pauley | last post by:
Hi, I'd like to generate my own icmp packets from within python. Typically this would include sending an ECHO_REQUEST and checking if I get an ECHO_REPLY back. But I would also like to...
0
by: T.C.McQueen | last post by:
Does anyone know how to receive an ICMP-Router Advertisement Message using Raw/ICMP - Sockets in Multicast -Mode with .NET I tried it several times differently but it does not work I think it's...
0
by: billiejoex | last post by:
Hi all. The source below is a simple icmp sniffer made with pcapy. To decode packets I'm using the EthDecoder() function that returns a rapresentation of the packet including ICMP type, ICMP code,...
1
by: Fotis | last post by:
hi there i have two questions 1)Is there a library class for ICMP packet creation ,management etc to use with C# 2)I have created a socket of icmp type and after sending a packet i call the...
0
by: Ed | last post by:
I've attached some VB.NET code I've hacked together (some taken from MS examples & newsgroup postings) that will perform a ping or IcmpSendEcho using the icmp.dll (see this for more info:...
5
by: Tom Anderson | last post by:
Hi all, This is a little function to compare two iterators: def icmp(a, b): for xa in a: try: xb = b.next()
1
by: Benks | last post by:
Hi I need a tool which can send ICMP-Requests as "Echo Request", "Timestamp Request" and so on. I'd prefer a command line tool. Does somebody know such a tool or no how to write such a tool? ...
32
by: Request-1 | last post by:
hi folks, html coder here, new and terrified * of php!! aaaaaa! i'm trying to bury a JS script to rotate a photo, in a page i converted from html to php. the conversion went well, it was to...
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: 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
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
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
Oralloy
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,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.