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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:12:10+00:00 2026-05-31T20:12:10+00:00

I have an application in which i bound a socket to an outgoing interface

  • 0

I have an application in which i bound a socket to an outgoing interface from among a few using SO_BINDTODEVICE.

Now the problem is when i receive a response, i need to know which interface it came from. The ip address alone from which the response came is not enough, because same ip is bound to multiple interfaces.

I have used the code below provided in stackoverflow questions. But it fails giving segmentation faults in the second iteration of for loop (the first iteration went into continue part of loop).

Can some one help?

C++ DGRAM socket get the RECEIVER address

How to tell which interface the socket received the message from?

  • 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-05-31T20:12:11+00:00Added an answer on May 31, 2026 at 8:12 pm

    The problem is resolved. The IP_PKTINFO option should be set right after socket creation before any other use of the socket and it works fine.

    In my case, i was using the socket after creation to send data out and latter added to a select descriptor set for reading. Then finally just before calling receive i was setting IP_PKTINFO and it returned interface index 0 always.

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

Sidebar

Related Questions

I have an application which extracts data from an XML file using XPath. If
I have a button in my application which is bound to a command. This
I have an application which takes a string value of the form %programfiles%\directory\tool.exe from
I have a network server application written in C, the listener is bound using
I have an action Edit in my WPF application, which is bound to items
In my WPF application I have a list of DocumentViewers which are bound to
I have a Python application which opens a simple TCP socket to communicate with
We have developed one android application which will send the request and receive the
I have a WinForms application which is using Entity Framework to query a database.
In a WPF application I'm writing, I have a TransformedBitmap property which is bound

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.