Solved

Referrence error C#

Posted on 2013-06-12
8
217 Views
Last Modified: 2013-06-13
I am getting the following error :

Error      3      The type or namespace name 'CaptureEventArgs' does not exist in the namespace 'SharpPcap' (are you missing an assembly reference?)      c:\users\samsung_pc\documents\visual studio 2012\Projects\Zynga\Zynga\Program.cs      70      77      Zynga


how should i resolve the following issue
error.png
0
Comment
Question by:3XLcom
  • 5
  • 3
8 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 39243026
Are you referencing the correct version of that library?
0
 

Author Comment

by:3XLcom
ID: 39243032
yes as you see it is blue
0
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 39243045
I suggest dropping those references and (re)installing it from NuGet. Doing so worked fine for me.

Screenshot
0
 

Author Comment

by:3XLcom
ID: 39243072
should you upload this tested file i tryed tens of time to reinstall references. But not worked for me maybe there is sth. wrong with my comp.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39243103
0
 

Author Comment

by:3XLcom
ID: 39243115
Strange result :

========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
0
 

Author Comment

by:3XLcom
ID: 39243117
when i add all code i get the same result

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _28155859
{
    class Program
    {
        public static void Main(string[] args)
        {
            // Print SharpPcap version
            string ver = SharpPcap.Version.VersionString;
            Console.WriteLine("SharpPcap {0}, Example5.PcapFilter.cs\n", ver);

            // Retrieve the device list
            var devices = CaptureDeviceList.Instance;

            // If no devices were found print an error
            if (devices.Count < 1)
            {
                Console.WriteLine("No devices were found on this machine");
                return;
            }

            Console.WriteLine("The following devices are available on this machine:");
            Console.WriteLine("----------------------------------------------------");
            Console.WriteLine();

            int i = 0;

            // Scan the list printing every entry
            foreach (var dev in devices)
            {
                Console.WriteLine("{0}) {1}", i, dev.Description);
                i++;
            }

            Console.WriteLine();
            Console.Write("-- Please choose a device to capture: ");
            i = int.Parse(Console.ReadLine());

            var device = devices[i];

            //Register our handler function to the 'packet arrival' event
            device.OnPacketArrival +=
                new PacketArrivalEventHandler(device_OnPacketArrival);

            //Open the device for capturing
            int readTimeoutMilliseconds = 1000;
            device.Open(DeviceMode.Promiscuous, readTimeoutMilliseconds);

            // tcpdump filter to capture only TCP/IP packets
            string filter = "ip and tcp";
            device.Filter = filter;

            Console.WriteLine();
            Console.WriteLine
                ("-- The following tcpdump filter will be applied: \"{0}\"",
                filter);
            Console.WriteLine
                ("-- Listening on {0}, hit 'Ctrl-C' to exit...",
                device.Description);

            // Start capture packets
            device.Capture();

            // Close the pcap device
            // (Note: this line will never be called since
            //  we're capturing infinite number of packets
            device.Close();
        }

        /// <summary>
        /// Prints the time and length of each received packet
        /// </summary>
        private static void device_OnPacketArrival(object sender, CaptureEventArgs e)
        {
            var time = e.Packet.Timeval.Date;
            var len = e.Packet.Data.Length;
            Console.WriteLine("{0}:{1}:{2},{3} Len={4}",
                time.Hour, time.Minute, time.Second, time.Millisecond, len);
        }
    }
}

Open in new window

0
 

Author Closing Comment

by:3XLcom
ID: 39245322
Thanks , i realized with this i select wrong framework version
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
asp.net mvc5 3 38
Expando 4 36
index Out OF Range Exception error 4 33
VB.NET HttpWebRequest 12 34
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now