Comments (21)
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.
@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.
@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.
from sharppcap.
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.
from sharppcap.
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.
@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.
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.
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.
Maybe this is being solved soon from the coreclr team..
https://github.com/dotnet/corefx/issues/32015
from sharppcap.
@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.
That's great news, thanks for the update!
from sharppcap.
@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.
@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.
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.
Hi @fukaminakrize, @AlexanderHermann, please check out the 4.6.0 release, it should address the cross platform issues with dotnet.
from sharppcap.
Hi @chmorgan, glad to hear the issue was addressed, thanks for the heads up!
from sharppcap.
I haven't solved it yet. I don't know why. I use the latest version.
from sharppcap.
is there a solution to this? i have the same problem, i'm on windows 10
from sharppcap.
@Humberto-Molina please open a separate ticket with details on your specific context.
from sharppcap.
Related Issues (20)
- How to capture and parse HTTP protocol packets HOT 1
- Forcing a process to communicate through the proxy HOT 6
- zerotier-one support
- SendPacket latency question HOT 7
- Question: Write to stream instead of file HOT 2
- Are there any examples of monitoring http or https? HOT 1
- Unable to load DLL 'wpcap' or one of its dependencies HOT 3
- IPv4 Length exceeds Packet Length during live device capture HOT 2
- get the packet info not from event HOT 3
- Libpcap 1.10+ rfmon not supported HOT 1
- Unable to get libpcap (and by extension sharppcap) to work on Ubuntu 20.04 HOT 8
- Timeval unchanged between captured packets in Example03 HOT 4
- Integration request. Are you interested? HOT 2
- Unable to load DLL 'wpcap' HOT 1
- wpcap.so: cannot open on linux build HOT 5
- CaptureFileWriterDevice.Write((RawCapture p) ignores PacketLength field HOT 4
- WinPcapDevice still in descriptions HOT 1
- Unable to activate the adapter (NpcapRemoteCapture Example) HOT 14
- New Nuget release
- SharpPcap.PcapException: 'Failed to open Error Code: 3)'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sharppcap.