Coder Social home page Coder Social logo

Comments (21)

oldsqlwnb avatar oldsqlwnb commented on May 18, 2024

The message says that you need to install the WinPcap driver https://www.winpcap.org/install/default.htm. But since you are working on Linux I have no Idea how one would go about it. Maybe try extracting the wcap.dll from the WinPcap driver and reference it directly into your project.

from sharppcap.

chmorgan avatar chmorgan commented on May 18, 2024

@oldsqlwnb the issue is a bit deeper than that. I'll probably end up implementing dynamic library loading to resolve it. If you run under mono then the SharpPcap.dll.config file's dllmap will take effect and let you map wpcap to libpcap. So the fix is to run under mono for now and ensure the dllmap is correct for the name of libpcap on your system. I'm hoping to have a better fix that is dotnet compatible but it does require a bit of code to dynamically load dlls based on platform etc.

from sharppcap.

AlexanderHermann avatar AlexanderHermann commented on May 18, 2024

@chmorgan Thanks for the clarification. Since my goal is to abstain from Mono and rely solely on .NET Core, I guess I will have to wait for the prospective solution of dynamically loading DLLs based on the platform.

from sharppcap.

chmorgan avatar chmorgan commented on May 18, 2024

from sharppcap.

los93sol avatar los93sol commented on May 18, 2024

An alternative that I used was to just drop the lip cap dll so it is published with the project and hard coded it to look for my dll.

@chmorgan, instead of trying to get fancy with some dynamic loader why not just have the caller pass in what they want to use?

from sharppcap.

chmorgan avatar chmorgan commented on May 18, 2024

from sharppcap.

los93sol avatar los93sol commented on May 18, 2024

I can’t say for certain about WinPcap, but for libpcap on Linux I didn’t have to install it, I just dropped the dll in the project bin folder and that works as expected. I’m not sure about licensing but it seems like you could split the NuGet packages so you could publish SharpPCap, WinPCap (that just contains the dll), and LibPCap (again just containing the dll). That would give you the ability to control the naming and guarantee the file exists in the bin which also helps ease deployment of apps using SharpPCap since you don’t need to make sure one or the other is present on the target machine. Just another idea to skin it.

from sharppcap.

chmorgan avatar chmorgan commented on May 18, 2024

@los93sol I'd really prefer not to ship libpcap along with the library. Then I'd have to worry about keeping that up-to-date, which architectures people were using 32bit vs. 64bit etc.

I'm glad dropping the file into the folder worked. One downside of the static specification approach that is being used today is that the library name is fixed. On linux especially the library names aren't super consistent. Mono took care of some of that but still required a .config file. If I had control over the library loading I could search wisely, looking for libpcap.so, then maybe libpcap1.so, libpcap.so.1 etc depending on what linux distributions are naming the library. That would let us drop the .config file entirely on linux (which only mono supports anyway).

from sharppcap.

chmorgan avatar chmorgan commented on May 18, 2024

PRs welcome if someone wants to look at addressing the dynamic loading issue. I don't think its super tough but I'd prefer to use a standard approach if only msft can get their act together and adopt at least one of the proposals.

from sharppcap.

winkmichael avatar winkmichael commented on May 18, 2024

Include SharpPcap.dll.config in the runtime directory next to SharpPCap.dll

<!-- Configuration file used by Mono to aid in dll mapping between platforms so the same
     assembly can be used on Windows, where it will find wpcap.dll, and on linux/mac where
     Mono will map the dll to libpcap.so.
     This file should be placed along side of the assembly dll or in a system searchable location.
     See http://www.mono-project.com/Interop_with_Native_Libraries#Library_Names -->
<configuration>
  <dllmap dll="wpcap" target="libpcap.so.0.8" os="linux" />
  <dllmap dll="wpcap" target="libpcap.dylib"  os="osx"   />
</configuration>

from sharppcap.

lukasvosyka avatar lukasvosyka commented on May 18, 2024

Maybe this is being solved soon from the coreclr team..

https://github.com/dotnet/corefx/issues/32015

from sharppcap.

chmorgan avatar chmorgan commented on May 18, 2024

@lukasvosyka yep, that is the new ticket to track that issue. When there is a dotnet solution I'll be applying that to sharppcap to resolve the issue.

from sharppcap.

AlexanderHermann avatar AlexanderHermann commented on May 18, 2024

That's great news, thanks for the update!

from sharppcap.

epasinetti avatar epasinetti commented on May 18, 2024

@chmorgan any news about this issue ? I can't get work with workaround of .config file.
I'm compiling the dotnet core app in VisualStudio 2017 on windows, is there any workaround to get work the library on Linux Debian 9 ?
Thank you

from sharppcap.

chmorgan avatar chmorgan commented on May 18, 2024

@epasinetti it sounds like the issue is still winding through the dotnet process. I'm getting some updates from the above ticket below but its been quiet for a week. If you are watching the above link to the api ticket I'd be interested when they get that into a usable form. At that point we'll want to get a PR in to support it and finally get proper dotnet support.

from sharppcap.

fukaminakrize avatar fukaminakrize commented on May 18, 2024

Hi @epasinetti, as a workaround to get sharppcap working on Linux using .net core, I've setup libwpcap.so link file pointing to installed libpcap.so (ln -s /usr/lib/x86_64-linux-gnu/libpcap.so.0.8 /usr/lib/x86_64-linux-gnu/libwpcap.so).

from sharppcap.

chmorgan avatar chmorgan commented on May 18, 2024

Hi @fukaminakrize, @AlexanderHermann, please check out the 4.6.0 release, it should address the cross platform issues with dotnet.

from sharppcap.

AlexanderHermann avatar AlexanderHermann commented on May 18, 2024

Hi @chmorgan, glad to hear the issue was addressed, thanks for the heads up!

from sharppcap.

bbhxwl avatar bbhxwl commented on May 18, 2024

I haven't solved it yet. I don't know why. I use the latest version.

from sharppcap.

humbertomoli99 avatar humbertomoli99 commented on May 18, 2024

is there a solution to this? i have the same problem, i'm on windows 10

from sharppcap.

kayoub5 avatar kayoub5 commented on May 18, 2024

@Humberto-Molina please open a separate ticket with details on your specific context.

from sharppcap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.