Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8463797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:33:18+00:00 2026-06-10T14:33:18+00:00

I am learning low level sockets with c++. I have done a simple program

  • 0

I am learning low level sockets with c++. I have done a simple program that shall send an ARP request. The socket seems to send the packet but I cannot catch it with Wireshark. I have another small program that also sends ARP packets and those packets are captured by Wireshark (my program below is inspired by that program).

Have I done something wrong?

Removed code

EDIT

Removed code

EDIT 2
It seems that I also need to include ethernet header data in the packet, so I now make a packet containing ethernet header and ARP header data. Now the packet goes away and is captured by Wireshark. But Wireshark says it is gratuitous. As you can see, nor IP or MAC address of sender and receiver seem to have been set properly.

36  13.318179   Cimsys_33:44:55 Broadcast   ARP 42  Gratuitous ARP for <No address> (Request)

EDIT 3

    /*Fill arp header data*/
    p.arp.ea_hdr.ar_hrd = htons(ARPHRD_ETHER); 
    p.arp.ea_hdr.ar_pro = htons(ETH_P_IP); 
    p.arp.ea_hdr.ar_hln = ETH_ALEN;            // Must be pure INTEGER, not called with htons(), as I did
    p.arp.ea_hdr.ar_pln = 4;                   // Must be pure INTEGER, not called with htons(), as I did
    p.arp.ea_hdr.ar_op = htons(ETH_P_ARP);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:33:19+00:00Added an answer on June 10, 2026 at 2:33 pm

    @user315052 say that you should use memcpy(arp->arp_spa, &s_in_addr, sizeof(arg->arp_spa)); but this code just copy first 4 bytes of s_in_addr to arp->arp_spa that absolutely do nothing!
    so just try this:

    * (int32_t*) arp->arp_spa = inet_addr("192.168.1.1")
    * (int32_t*) arp->arp_tpa = inet_addr("192.168.1.2")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started learning how to program Windows GUI's using the low level
hi i am a student and just start learning low level c programming.i tried
I've been learning C: it's a beautiful, well-thought-out language. However, it is so low-level
To date I've done a lot of low-level programming (kernel-mode device drivers, native code,
I am learning High Level Assembly language at the moment and have been going
Learning a lot in my few years of programming that the best projects are
Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
It seems that all questions regarding this topic are very specific, and while I
Don't be afraid to use any technical jargon or low-level explanations for things, please.
So C obviously has a pretty dominant low level programming stronghold.....but is anything coming

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.