Results 1 to 3 of 3

Thread: Problem with inet_addr()

  1. #1
    Join Date
    Dec 2012
    Beans
    2

    Problem with inet_addr()

    I wrote a small program in C++.
    To populate the socketaddr_in I used inet_addr, to convert from dotted decimal to binary, in bigendian order.
    The problem is that, despite the program runs and shows that the message was sent, nothing appears on the Wireshark screen. If I use htonl(inet_addr()), Wireshark show my datagram but with the IP address reversed (from 127.0.0.1 to 1.0.0.127, which is understandable). I wonder if any of you already had this problem and could help me.
    Tks.

  2. #2
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    5,563
    Distro
    Xubuntu 14.10 Utopic Unicorn

    Re: Problem with inet_addr()

    If you are sending to 127.0.0.1 then you need to get wireshark to look at interface lo (or all interfaces) rather then looking at eth0. Don't know if that's your problem, just a wild guess.

  3. #3
    Join Date
    Dec 2012
    Beans
    2

    Re: Problem with inet_addr()

    It worked very well. My code is allright. The problem was configuring Wireshark the right way.
    Thanks a lot.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •