Commit fea0df18 authored by Brickner_cp's avatar Brickner_cp

Added project to Developer's Pack

parent 65b9170e
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{76C60DD0-9E5C-40E5-9EE5-B820978824A5}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GatheringStatisticsOnTheNetworkTraffic</RootNamespace>
<AssemblyName>GatheringStatisticsOnTheNetworkTraffic</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Packets, Version=0.1.0.33384, Culture=neutral, PublicKeyToken=58cf32d85728e684, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\3rdParty\PcapDotNet\Packets.dll</HintPath>
</Reference>
<Reference Include="PcapDotNet.Core, Version=0.1.0.39245, Culture=neutral, PublicKeyToken=58cf32d85728e684, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\3rdParty\PcapDotNet\PcapDotNet.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
using System;
using System.Collections.Generic;
using PcapDotNet.Core;
namespace GatheringStatisticsOnTheNetworkTraffic
{
class Program
{
static void Main(string[] args)
{
// Retrieve the device list from the local machine
IList<LivePacketDevice> allDevices = LivePacketDevice.AllLocalMachine;
if (allDevices.Count == 0)
{
Console.WriteLine("No interfaces found! Make sure WinPcap is installed.");
return;
}
// Print the list
for (int i = 0; i != allDevices.Count; ++i)
{
LivePacketDevice device = allDevices[i];
Console.Write((i + 1) + ". " + device.Name);
if (device.Description != null)
Console.WriteLine(" (" + device.Description + ")");
else
Console.WriteLine(" (No description available)");
}
int deviceIndex = 0;
do
{
Console.WriteLine("Enter the interface number (1-" + allDevices.Count + "):");
string deviceIndexString = Console.ReadLine();
if (!int.TryParse(deviceIndexString, out deviceIndex) ||
deviceIndex < 1 || deviceIndex > allDevices.Count)
{
deviceIndex = 0;
}
} while (deviceIndex == 0);
// Take the selected adapter
PacketDevice selectedOutputDevice = allDevices[deviceIndex - 1];
// Open the output adapter
using (
PacketCommunicator communicator = selectedOutputDevice.Open(100, PacketDeviceOpenAttributes.Promiscuous,
1000))
{
// Compile and set the filter
communicator.SetFilter("tcp");
// Put the interface in statstics mode
communicator.Mode = PacketCommunicatorMode.Statistics;
Console.WriteLine("TCP traffic summary:");
// Start the main loop
communicator.ReceiveStatistics(0, StatisticsHandler);
}
}
private static void StatisticsHandler(PacketSampleStatistics statistics)
{
// Current sample time
DateTime currentTimestamp = statistics.Timestamp;
// Previous sample time
DateTime previousTimestamp = _lastTimestamp;
// Set _lastTimestamp for the next iteration
_lastTimestamp = currentTimestamp;
// If there wasn't a previous sample than skip this iteration (it's the first iteration)
if (previousTimestamp == DateTime.MinValue)
return;
// Calculate the delay from the last sample
double delayInSeconds = (currentTimestamp - previousTimestamp).TotalSeconds;
// Calculate bits per second
double bitsPerSecond = statistics.AcceptedBytes * 8 / delayInSeconds;
// Calculate packets per second
double packetsPerSecond = statistics.AcceptedPackets / delayInSeconds;
// Print timestamp and samples
Console.WriteLine(statistics.Timestamp + " BPS: " + bitsPerSecond + " PPS: " + packetsPerSecond);
}
private static DateTime _lastTimestamp;
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("GatheringStatisticsOnTheNetworkTraffic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GatheringStatisticsOnTheNetworkTraffic")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("56ab2b55-9ce4-4685-9120-875719eee699")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
...@@ -19,9 +19,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendingASinglePacketWithSen ...@@ -19,9 +19,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendingASinglePacketWithSen
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendingPacketsUsingSendBuffer", "SendingPacketsUsingSendBuffer\SendingPacketsUsingSendBuffer.csproj", "{6BEDD1BC-579B-4C1B-AAAE-1CD4BDF14EC3}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendingPacketsUsingSendBuffer", "SendingPacketsUsingSendBuffer\SendingPacketsUsingSendBuffer.csproj", "{6BEDD1BC-579B-4C1B-AAAE-1CD4BDF14EC3}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GatheringStatisticsOnTheNetworkTraffic", "GatheringStatisticsOnTheNetworkTraffic\GatheringStatisticsOnTheNetworkTraffic.csproj", "{76C60DD0-9E5C-40E5-9EE5-B820978824A5}"
EndProject
Global Global
GlobalSection(TeamFoundationVersionControl) = preSolution GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 10 SccNumberOfProjects = 11
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://tfs06.codeplex.com/ SccTeamFoundationServer = https://tfs06.codeplex.com/
SccLocalPath0 = . SccLocalPath0 = .
...@@ -52,6 +54,9 @@ Global ...@@ -52,6 +54,9 @@ Global
SccProjectUniqueName9 = SendingPacketsUsingSendBuffer\\SendingPacketsUsingSendBuffer.csproj SccProjectUniqueName9 = SendingPacketsUsingSendBuffer\\SendingPacketsUsingSendBuffer.csproj
SccProjectName9 = SendingPacketsUsingSendBuffer SccProjectName9 = SendingPacketsUsingSendBuffer
SccLocalPath9 = SendingPacketsUsingSendBuffer SccLocalPath9 = SendingPacketsUsingSendBuffer
SccProjectUniqueName10 = GatheringStatisticsOnTheNetworkTraffic\\GatheringStatisticsOnTheNetworkTraffic.csproj
SccProjectName10 = GatheringStatisticsOnTheNetworkTraffic
SccLocalPath10 = GatheringStatisticsOnTheNetworkTraffic
EndGlobalSection EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
...@@ -94,6 +99,10 @@ Global ...@@ -94,6 +99,10 @@ Global
{6BEDD1BC-579B-4C1B-AAAE-1CD4BDF14EC3}.Debug|Any CPU.Build.0 = Debug|Any CPU {6BEDD1BC-579B-4C1B-AAAE-1CD4BDF14EC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6BEDD1BC-579B-4C1B-AAAE-1CD4BDF14EC3}.Release|Any CPU.ActiveCfg = Release|Any CPU {6BEDD1BC-579B-4C1B-AAAE-1CD4BDF14EC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6BEDD1BC-579B-4C1B-AAAE-1CD4BDF14EC3}.Release|Any CPU.Build.0 = Release|Any CPU {6BEDD1BC-579B-4C1B-AAAE-1CD4BDF14EC3}.Release|Any CPU.Build.0 = Release|Any CPU
{76C60DD0-9E5C-40E5-9EE5-B820978824A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76C60DD0-9E5C-40E5-9EE5-B820978824A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76C60DD0-9E5C-40E5-9EE5-B820978824A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76C60DD0-9E5C-40E5-9EE5-B820978824A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using Packets; using Packets;
using PcapDotNet.Core; using PcapDotNet.Core;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment