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 9024815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:07:08+00:00 2026-06-16T06:07:08+00:00

I am trying to implement a python traceroute that sends UDP messages and receives

  • 0

I am trying to implement a python traceroute that sends UDP messages and receives the ICMP responses via raw sockets. I’ve run into an issue where the ICMP packets seem to avoid capture at all cost. The ICMP responses show up in wireshark as exactly what I’d expect, but the socket never receives any data to read. Another complication is that I am running the code on VirtualBox running Ubuntu, as the sendto() would not get the packets on the wire in Windows 7. (I’m running wireshark in windows to capture the packets). The strange thing is that wireshark will capture the ICMP messages when I run the python script from the virtual machine. However, when I try to run the script on windows, the ICMP messages don’t show up in wireshark. (The UDP packets have magically started working on windows)

I’ve played around with all sorts of different versions of setting up the socket from online examples, and played around with using bind() and not using it, but no configuration seems to produce a socket that reads. It will just time out waiting to read the ICMP message.

It should also be noted that if I try to read my udp sending socket, it successfully reads the udp packets. As soon as I set IPPROTO_ICMP the read times out.

receive_response method:

def receive_response(rec_socket, packetid, tsend, timeout):
    remain = timeout
    print packetid
    while remain > 0:
        ready = select.select([rec_socket], [], [], remain)
        if ready[0] == []:
            return
        print 'got something'

setting up the socket:

rec_socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, ICMP_CODE)
rec_socket.setsockopt(socket.SOL_IP, socket.IP_HDRINCL, 1)
rec_socket.bind(("",0))      #played with using this statement and skipping it

call to receive is simply:

reached = receive_response(rec_socket, packetid, time.time(), timeout)
  • 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-16T06:07:10+00:00Added an answer on June 16, 2026 at 6:07 am

    It looks like the problem is VirtualBox will default to using NAT to connect to the network. This means that the virtual machine won’t receive the ICMP messages by virtue of them being ICMP messages. It seems like the solution to this is to configure VirtualBox networking to use “Bridged networking” mode. Unfortunately I cannot confirm this as I can’t set up the virtual machine on my university’s network within bridged mode. As for the reason they didn’t work in windows, it must be related to windows’ lack of support for raw sockets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement an ICMP based Traceroute in Python. I found a
For my Computer Networking class, I'm trying to implement Traceroute using raw sockets with
I am trying to implement an ICMP based Traceroute in Python. I found a
I'm new to python but I've run into a hitch when trying to implement
I'm trying to implement dynamic reloading objects in Python, that reflect code changes live.
I'm trying to implement a fairly simple card game in Python so that two
I'm trying to understand the best way to implement Python's ConfigParser so that elements
I'm trying to implement a python cmd, using the cmd module. I want to
I am trying to implement quicksort in python: def partition(ls): if len(ls) == 0:
I'm trying to implement quicksort in Python using 2 main functions - partition and

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.