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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:43:22+00:00 2026-05-18T07:43:22+00:00

I am trying to listen on two devices with libpcap but I still cant

  • 0

I am trying to listen on two devices with libpcap but I still cant find out how to do the trick. I tried to set device to “any” but it isnt working. I am trying to write dhcp relay agent so i need to listen on eth0 and eth1.

I tried to create two pcap_loops, each with different device and handler, but only first pcap_loop works, second one is ignored.

Is there any way how to do this or should I leave libpcap and try to do it with raw sockets?

  • 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-18T07:43:22+00:00Added an answer on May 18, 2026 at 7:43 am

    You’ll need to run your pcap_loop() in separate threads, one for each interface, we do that, and it works.

    Some parts of libpcap, isn’t thread safe though, atleast pcap_setfilter(), so provide your own locking around that.

    If you do no want to use threads, you’ll have to provide an event loop yourself, where you monitor the file descriptors of each device with select/poll or similar. You can get the file descriptor for a device handle with pcap_get_selectable_fd().

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

Sidebar

Related Questions

I am trying to listen tab-in tab-out action for my swing gui that is
I am trying to listen to RabbitMQ queue by polling it. But somehow due
I'm trying to figure out how I can listen to the Cancel button that
I'm trying to find the correct event to listen for that will ensure that
I'm trying to find a way to have a page listen to which users
I've been trying to listen for changes in the status bar height – such
I am trying to listen to mouse events coming from both a JLabel and
I'm trying to query a set of buldings listed on a table, these buildings
I am trying to set up a webserver on an old machine of mine.
I've spent two days on this and have gotten nowhere. I'm trying to use

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.