SharpPcap OnPcapStatistics event never fires? - c#

I am trying to get SharpPcap Statistics to work, but the OnPcapStatistics event never fires.
Here's the code: SharpPcap Example 11: statistics
Code project article: SharpPcap: Statistics
Does anyone know why?

You just found a bug!
WinPcapDevice was creating a new SendPacketArrivalEvent() instead of overriding it. Modified PcapDevice.SendPacketArrivalEvent() to be a virtual and WinPcapDevice.SendPacketArrivalEvent() to be an override and now the correct method is called.
The issue was that because WinPcapDevice was creating a new method instead of overriding it that PcapDevice was capturing a packet and calling its own SendPacketArrivalEvent(). This implementation doesn't handle statistics events as they are specific to WinPcapDevices.
Fixed the issue, updated the assembly info to 4.0.1 and uploaded the assembly to filedropper:
http://www.filedropper.com/sharppcap
If you could try that and see that it works I'll check the fix into git and it will go out with the next release of SharpPcap.
Thanks again for the bug report.
Chris
Author of SharpPcap

Related

Xamarin.ios, Failed to lookup the required marshalling information

I am trying to use an outlet to alter the text in a TextField, but whenever I make any reference to the outlet, I receive an error saying "Failed to lookup the required marshaling information". I am new to Xamarin.IOS, and working with Xcode, and I have searched for an answer to my issue but there is nothing that fixes my issue.
ClientClass.cs
ClientClass.designer.cs
Inspector of ViewController using ClientClass
I figured it out, The issue with my case is I wasn't writing my code in the correct method. I guess you have to write your code in the ViewDidLoad method as I understand.

Plugin.InAppBilling.PurchaseAsync never returns

I am attempting to use the InAppBilling plugin to make purchases on Android and I am using the code described here: https://jamesmontemagno.github.io/InAppBillingPlugin/PurchaseNonConsumable.html
Everything seems to work correctly and I am able to complete the purchase. However the await PurchaseAsync call never returns after the purchase is complete. The purchase does go through, however, and if I later call the GetPurchasesAsync function, it shows that I do own the item.
Any ideas as to what I might be doing wrong would be appreciated.
Thanks.
I apparently did not read the documentation properly and was missing the OnActivityResult override in the MainActivity.

The latest version (6.0.20) of Akavache seems to be partly broken when used in Xamarin.iOS?

I was originally trying to fetch and cache an image using BlobCache.LocalMachine.LoadImageFromUrl(someURL), but I found that it
just stopped responding after I called this method. (Yes, I've set BlobCache.ApplicationName, I even called BlobCache.EnsureInitialized(), and the SQL3 lib wasn't stripped by the linker.) So I did some experiments and tried to find out what was wrong.
After several hours of testing I found that only these methods should work in my circumstances:
1.
BlobCache.LocalMachine.DownloadUrl(someURL).Wait(); // Can fetch the right image file but it won't store it into cache; The cache disappears if I restart the app
var image = BlobCache.LocalMachine.LoadImage(someURL).Wait().ToNative(); // This part is good
2.
BlobCache.LocalMachine.InsertObject<string>(key, value).Wait();
var value = BlobCache.LocalMachine.GetObject<string>(key).Wait(); // This functions well; I can get the correct value right away after a restart
Also, whenever I use await in my code, it falls to infinite deadlock(?). Say, var value = await BlobCache.LocalMachine.GetObject<string>(key);. (Of course I've imported System.Reactive.Linq.) The possible workaround to me is to use wait() or subscribe() instead.
BlobCache.LocalMachine.GetOrFetchObject() won't work either.
P.S.: I have the latest Xamarin.iOS & Mono build on my VS Mac.
So did I miss anything that's important when using Akavache in Xamarin.iOS?
Please enlighten me.🤭
I've posted an issue here.

Tapi3Lib Adding a new line at runtime

I am having some trouble with the interop.tapi3lib.dll (which can be DL here:dllLink)
For a reporting program i'm writing, i want to monitor all of the devices available by the tapi for their calls. Now this is working nicely when i fire up the program, although i suspect the dll is written with the purpose of modifying calls on a single extension, with very little code i can see all of the activity perfectly.
The problem arrises when a user logs out (or in) a phone (I'm using this for a cisco Callmanager). At that time i am able to capture the tapi_object which in turn can be used to determine which line is removed and added (old number and new number) but i can't register the new address for sending events.
The exception when i try:
Value does not fall within the expected range.
because the tapiclass was created before this address was available i suspect.
At the moment i have done a test which creates a single tapiclass for each line individual and 1 tapiclass for monitoring the tapiobject event, but this is eating 10 times the memory for our company's configuration (20 phones) so i dont even want to test this at the target site (+300 phones). The other option (for i can think of) is to dispose the 'old' tapiclass and create a new one after, however i'm a bit concerned with either loosing events between, getting double events between and pingpong when multiple users log in/out (creating the class takes a couple of seconds with my program)
So, what i would really like is the option to
tapi.RegisterCallNotifications(ad, true, true, TAPI3Lib.TapiConstants.TAPIMEDIATYPE_AUDIO, 2);
for newly available lines.
Bit of background for answers :)
-I am fairly new to C#, completly new to COM-interop and i know the principles of C++, but ive never written anything in it.
Any help would greatly be appriciated. (also any comments about interop and such)
Hmm, turns out I was wrong. Adding the line for notification is possible and does not throw the exception. I think i didn't remove the old line before adding the new in my old sample.

"Invalid postback or callback argument" after new deployment

Recently deployed a project into production and have run into the "Invalid postback or callback argument" error. We haven't encountered this in testing at all and after some research have found that the problem occurs in the following situation:
Old version is published and accessed.
New version is published and accessed without clearing the Temporary Files.
Drop down is changed twice. (The first time everything works fine.)
The fix for the clients that have called in has been to clear their temporary internet files but this isn't the ideal fix. Can anyone think of a reason why this would be happening and stop happening after the temp files have been cleared?
BTW: The app is ASP.NET 3.5 written in C#. We're using a javascript call back in this particular control that's causing this issue.
We didn't want to use the "enableEventValidation=false" trick as this isn't a consistent issue. From pretty early on, we were able to fix the issue case by case by clearing the temp files.
After some more looking today it was suggested that we rename our js file and behold, the issue is resolved locally. Seems that each user has had our old js file stored.
As to why it was throwing the "Invalid Postback" rather than a javascript error, we're not sure. There are other ways of specifying the version number in the script tags but for now we opted for the rename.
Since you mentioned that you're using a javascript callback, this may be related to event validation. If that's so, there is a workaround for that problem which is adding the following line to web.config:
<pages enableEventValidation="false"/>
So that, event validation is disabled in your pages. To turn it off is not recommended for security reasons because it verifies that arguments are originated by the server control.
You can get detailed information here about why this error occurs.

Categories

Resources