├── .gitignore
├── IPScanner.sln
├── IPScanner
├── FodyWeavers.xml
├── IPAddressControlLib.dll
├── IPRanges.cs
├── IPScanner.csproj
├── IPScannerForm.Designer.cs
├── IPScannerForm.cs
├── IPScannerForm.resx
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── RangeSelector.Designer.cs
├── RangeSelector.cs
├── RangeSelector.resx
├── ResponseAnalyze.Designer.cs
├── ResponseAnalyze.cs
├── ResponseAnalyze.resx
├── app.config
└── packages.config
├── IPScannerLib
├── HiResTimer.cs
├── HttpHelper.cs
├── IPScanResult.cs
├── IPScannerLib.csproj
├── NetworkScanner.cs
├── Properties
│ └── AssemblyInfo.cs
├── ScanStatus.cs
├── SmartThreadPool.XML
└── SmartThreadPool.dll
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # MSTest test Results
33 | [Tt]est[Rr]esult*/
34 | [Bb]uild[Ll]og.*
35 |
36 | # NUNIT
37 | *.VisualState.xml
38 | TestResult.xml
39 |
40 | # Build Results of an ATL Project
41 | [Dd]ebugPS/
42 | [Rr]eleasePS/
43 | dlldata.c
44 |
45 | # .NET Core
46 | project.lock.json
47 | project.fragment.lock.json
48 | artifacts/
49 | **/Properties/launchSettings.json
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 | *.VC.db
88 | *.VC.VC.opendb
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 | *.sap
95 |
96 | # TFS 2012 Local Workspace
97 | $tf/
98 |
99 | # Guidance Automation Toolkit
100 | *.gpState
101 |
102 | # ReSharper is a .NET coding add-in
103 | _ReSharper*/
104 | *.[Rr]e[Ss]harper
105 | *.DotSettings.user
106 |
107 | # JustCode is a .NET coding add-in
108 | .JustCode
109 |
110 | # TeamCity is a build add-in
111 | _TeamCity*
112 |
113 | # DotCover is a Code Coverage Tool
114 | *.dotCover
115 |
116 | # Visual Studio code coverage results
117 | *.coverage
118 | *.coveragexml
119 |
120 | # NCrunch
121 | _NCrunch_*
122 | .*crunch*.local.xml
123 | nCrunchTemp_*
124 |
125 | # MightyMoose
126 | *.mm.*
127 | AutoTest.Net/
128 |
129 | # Web workbench (sass)
130 | .sass-cache/
131 |
132 | # Installshield output folder
133 | [Ee]xpress/
134 |
135 | # DocProject is a documentation generator add-in
136 | DocProject/buildhelp/
137 | DocProject/Help/*.HxT
138 | DocProject/Help/*.HxC
139 | DocProject/Help/*.hhc
140 | DocProject/Help/*.hhk
141 | DocProject/Help/*.hhp
142 | DocProject/Help/Html2
143 | DocProject/Help/html
144 |
145 | # Click-Once directory
146 | publish/
147 |
148 | # Publish Web Output
149 | *.[Pp]ublish.xml
150 | *.azurePubxml
151 | # TODO: Comment the next line if you want to checkin your web deploy settings
152 | # but database connection strings (with potential passwords) will be unencrypted
153 | *.pubxml
154 | *.publishproj
155 |
156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
157 | # checkin your Azure Web App publish settings, but sensitive information contained
158 | # in these scripts will be unencrypted
159 | PublishScripts/
160 |
161 | # NuGet Packages
162 | *.nupkg
163 | # The packages folder can be ignored because of Package Restore
164 | **/packages/*
165 | # except build/, which is used as an MSBuild target.
166 | !**/packages/build/
167 | # Uncomment if necessary however generally it will be regenerated when needed
168 | #!**/packages/repositories.config
169 | # NuGet v3's project.json files produces more ignorable files
170 | *.nuget.props
171 | *.nuget.targets
172 |
173 | # Microsoft Azure Build Output
174 | csx/
175 | *.build.csdef
176 |
177 | # Microsoft Azure Emulator
178 | ecf/
179 | rcf/
180 |
181 | # Windows Store app package directories and files
182 | AppPackages/
183 | BundleArtifacts/
184 | Package.StoreAssociation.xml
185 | _pkginfo.txt
186 |
187 | # Visual Studio cache files
188 | # files ending in .cache can be ignored
189 | *.[Cc]ache
190 | # but keep track of directories ending in .cache
191 | !*.[Cc]ache/
192 |
193 | # Others
194 | ClientBin/
195 | ~$*
196 | *~
197 | *.dbmdl
198 | *.dbproj.schemaview
199 | *.jfm
200 | *.pfx
201 | *.publishsettings
202 | orleans.codegen.cs
203 |
204 | # Since there are multiple workflows, uncomment next line to ignore bower_components
205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
206 | #bower_components/
207 |
208 | # RIA/Silverlight projects
209 | Generated_Code/
210 |
211 | # Backup & report files from converting an old project file
212 | # to a newer Visual Studio version. Backup files are not needed,
213 | # because we have git ;-)
214 | _UpgradeReport_Files/
215 | Backup*/
216 | UpgradeLog*.XML
217 | UpgradeLog*.htm
218 |
219 | # SQL Server files
220 | *.mdf
221 | *.ldf
222 | *.ndf
223 |
224 | # Business Intelligence projects
225 | *.rdl.data
226 | *.bim.layout
227 | *.bim_*.settings
228 |
229 | # Microsoft Fakes
230 | FakesAssemblies/
231 |
232 | # GhostDoc plugin setting file
233 | *.GhostDoc.xml
234 |
235 | # Node.js Tools for Visual Studio
236 | .ntvs_analysis.dat
237 | node_modules/
238 |
239 | # Typescript v1 declaration files
240 | typings/
241 |
242 | # Visual Studio 6 build log
243 | *.plg
244 |
245 | # Visual Studio 6 workspace options file
246 | *.opt
247 |
248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
249 | *.vbw
250 |
251 | # Visual Studio LightSwitch build output
252 | **/*.HTMLClient/GeneratedArtifacts
253 | **/*.DesktopClient/GeneratedArtifacts
254 | **/*.DesktopClient/ModelManifest.xml
255 | **/*.Server/GeneratedArtifacts
256 | **/*.Server/ModelManifest.xml
257 | _Pvt_Extensions
258 |
259 | # Paket dependency manager
260 | .paket/paket.exe
261 | paket-files/
262 |
263 | # FAKE - F# Make
264 | .fake/
265 |
266 | # JetBrains Rider
267 | .idea/
268 | *.sln.iml
269 |
270 | # CodeRush
271 | .cr/
272 |
273 | # Python Tools for Visual Studio (PTVS)
274 | __pycache__/
275 | *.pyc
276 |
277 | # Cake - Uncomment if you are using it
278 | # tools/**
279 | # !tools/packages.config
280 |
281 | # Telerik's JustMock configuration file
282 | *.jmconfig
283 |
284 | # BizTalk build output
285 | *.btp.cs
286 | *.btm.cs
287 | *.odx.cs
288 | *.xsd.cs
289 |
--------------------------------------------------------------------------------
/IPScanner.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26430.6
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPScanner", "IPScanner\IPScanner.csproj", "{5C07071F-125F-419F-94CF-5E20D98A141A}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPScannerLib", "IPScannerLib\IPScannerLib.csproj", "{BBA2E4E7-6448-44D5-A141-3E5A8DA1BEDC}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|x86 = Debug|x86
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {5C07071F-125F-419F-94CF-5E20D98A141A}.Debug|x86.ActiveCfg = Debug|x86
17 | {5C07071F-125F-419F-94CF-5E20D98A141A}.Debug|x86.Build.0 = Debug|x86
18 | {5C07071F-125F-419F-94CF-5E20D98A141A}.Release|x86.ActiveCfg = Release|x86
19 | {5C07071F-125F-419F-94CF-5E20D98A141A}.Release|x86.Build.0 = Release|x86
20 | {BBA2E4E7-6448-44D5-A141-3E5A8DA1BEDC}.Debug|x86.ActiveCfg = Debug|x86
21 | {BBA2E4E7-6448-44D5-A141-3E5A8DA1BEDC}.Debug|x86.Build.0 = Debug|x86
22 | {BBA2E4E7-6448-44D5-A141-3E5A8DA1BEDC}.Release|x86.ActiveCfg = Release|x86
23 | {BBA2E4E7-6448-44D5-A141-3E5A8DA1BEDC}.Release|x86.Build.0 = Release|x86
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/IPScanner/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/IPScanner/IPAddressControlLib.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bp2008/IPScanner/8740b25f491aba6707b2e3983e7264c2a7e4c195/IPScanner/IPAddressControlLib.dll
--------------------------------------------------------------------------------
/IPScanner/IPRanges.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Net;
5 | using System.Net.NetworkInformation;
6 | using System.Net.Sockets;
7 | using System.Text;
8 |
9 | namespace IPScanner
10 | {
11 | public static class IPRanges
12 | {
13 | public static List> GetOperationalIPRanges()
14 | {
15 | List> ranges = new List>();
16 |
17 | foreach (NetworkInterface netInterface in NetworkInterface.GetAllNetworkInterfaces())
18 | {
19 | if (netInterface.OperationalStatus != OperationalStatus.Up)
20 | continue;
21 | IPInterfaceProperties ipProps = netInterface.GetIPProperties();
22 | foreach (UnicastIPAddressInformation addr in ipProps.UnicastAddresses)
23 | {
24 | if (addr.Address.AddressFamily == AddressFamily.InterNetwork)
25 | ranges.Add(new Tuple(GetLowestInRange(addr.Address, addr.IPv4Mask), GetHighestInRange(addr.Address, addr.IPv4Mask)));
26 | }
27 | }
28 | return ranges;
29 | }
30 | private static IPAddress GetLowestInRange(IPAddress address, IPAddress mask)
31 | {
32 | byte[] addressBytes = address.GetAddressBytes();
33 | byte[] maskBytes = mask.GetAddressBytes();
34 | if (addressBytes.Length != 4 || maskBytes.Length != 4)
35 | return IPAddress.None;
36 | byte[] lowest = new byte[4];
37 | for (var i = 0; i < 4; i++)
38 | lowest[i] = (byte)(addressBytes[i] & maskBytes[i]);
39 | return new IPAddress(lowest);
40 | }
41 | private static IPAddress GetHighestInRange(IPAddress address, IPAddress mask)
42 | {
43 | byte[] addressBytes = address.GetAddressBytes();
44 | byte[] maskBytes = mask.GetAddressBytes();
45 | if (addressBytes.Length != 4 || maskBytes.Length != 4)
46 | return IPAddress.None;
47 | byte[] highest = new byte[4];
48 | for (var i = 0; i < 4; i++)
49 | highest[i] = (byte)((addressBytes[i] & maskBytes[i]) | ~maskBytes[i]);
50 | return new IPAddress(highest);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/IPScanner/IPScanner.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {5C07071F-125F-419F-94CF-5E20D98A141A}
9 | WinExe
10 | Properties
11 | IPScanner
12 | IPScanner
13 | v4.0
14 |
15 |
16 | 512
17 |
18 |
19 |
20 |
21 | x86
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | x86
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 |
41 | ..\packages\Costura.Fody.1.6.2\lib\portable-net+sl+win+wpa+wp\Costura.dll
42 | False
43 |
44 |
45 | .\IPAddressControlLib.dll
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | Form
62 |
63 |
64 | IPScannerForm.cs
65 |
66 |
67 |
68 |
69 | Form
70 |
71 |
72 | RangeSelector.cs
73 |
74 |
75 | Form
76 |
77 |
78 | ResponseAnalyze.cs
79 |
80 |
81 | IPScannerForm.cs
82 |
83 |
84 | ResXFileCodeGenerator
85 | Resources.Designer.cs
86 | Designer
87 |
88 |
89 | True
90 | Resources.resx
91 | True
92 |
93 |
94 | RangeSelector.cs
95 |
96 |
97 | ResponseAnalyze.cs
98 |
99 |
100 |
101 |
102 | SettingsSingleFileGenerator
103 | Settings.Designer.cs
104 |
105 |
106 | True
107 | Settings.settings
108 | True
109 |
110 |
111 |
112 |
113 | {BBA2E4E7-6448-44D5-A141-3E5A8DA1BEDC}
114 | IPScannerLib
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | mkdir "$(SolutionDir)$(ConfigurationName)"
123 | copy "$(TargetPath)" "$(SolutionDir)$(ConfigurationName)\$(TargetFileName)"
124 |
125 |
126 |
127 |
128 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
129 |
130 |
131 |
132 |
133 |
134 |
141 |
--------------------------------------------------------------------------------
/IPScanner/IPScannerForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace IPScanner
2 | {
3 | partial class IPScannerForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.lvIPList = new System.Windows.Forms.ListView();
32 | this.chIP = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
33 | this.chPing = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
34 | this.chHost = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
35 | this.chRecognized = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
36 | this.ipFrom = new IPAddressControlLib.IPAddressControl();
37 | this.label1 = new System.Windows.Forms.Label();
38 | this.label2 = new System.Windows.Forms.Label();
39 | this.ipTo = new IPAddressControlLib.IPAddressControl();
40 | this.btnScan = new System.Windows.Forms.Button();
41 | this.btnAnalyzeSelected = new System.Windows.Forms.Button();
42 | this.btnRanges = new System.Windows.Forms.Button();
43 | this.SuspendLayout();
44 | //
45 | // lvIPList
46 | //
47 | this.lvIPList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
48 | | System.Windows.Forms.AnchorStyles.Left)
49 | | System.Windows.Forms.AnchorStyles.Right)));
50 | this.lvIPList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
51 | this.chIP,
52 | this.chPing,
53 | this.chHost,
54 | this.chRecognized});
55 | this.lvIPList.FullRowSelect = true;
56 | this.lvIPList.Location = new System.Drawing.Point(-1, 33);
57 | this.lvIPList.MultiSelect = false;
58 | this.lvIPList.Name = "lvIPList";
59 | this.lvIPList.Size = new System.Drawing.Size(626, 230);
60 | this.lvIPList.TabIndex = 0;
61 | this.lvIPList.UseCompatibleStateImageBehavior = false;
62 | this.lvIPList.View = System.Windows.Forms.View.Details;
63 | //
64 | // chIP
65 | //
66 | this.chIP.Text = "IP";
67 | this.chIP.Width = 93;
68 | //
69 | // chPing
70 | //
71 | this.chPing.Text = "Ping";
72 | //
73 | // chHost
74 | //
75 | this.chHost.Text = "Host";
76 | this.chHost.Width = 88;
77 | //
78 | // chRecognized
79 | //
80 | this.chRecognized.Text = "Recognized as";
81 | this.chRecognized.Width = 119;
82 | //
83 | // ipFrom
84 | //
85 | this.ipFrom.AllowInternalTab = false;
86 | this.ipFrom.AutoHeight = true;
87 | this.ipFrom.BackColor = System.Drawing.SystemColors.Window;
88 | this.ipFrom.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
89 | this.ipFrom.Cursor = System.Windows.Forms.Cursors.IBeam;
90 | this.ipFrom.Location = new System.Drawing.Point(68, 6);
91 | this.ipFrom.MinimumSize = new System.Drawing.Size(87, 20);
92 | this.ipFrom.Name = "ipFrom";
93 | this.ipFrom.ReadOnly = false;
94 | this.ipFrom.Size = new System.Drawing.Size(112, 20);
95 | this.ipFrom.TabIndex = 1;
96 | this.ipFrom.Text = "192.168.0.1";
97 | //
98 | // label1
99 | //
100 | this.label1.AutoSize = true;
101 | this.label1.Location = new System.Drawing.Point(12, 9);
102 | this.label1.Name = "label1";
103 | this.label1.Size = new System.Drawing.Size(50, 13);
104 | this.label1.TabIndex = 2;
105 | this.label1.Text = "IP range:";
106 | //
107 | // label2
108 | //
109 | this.label2.AutoSize = true;
110 | this.label2.Location = new System.Drawing.Point(186, 9);
111 | this.label2.Name = "label2";
112 | this.label2.Size = new System.Drawing.Size(16, 13);
113 | this.label2.TabIndex = 4;
114 | this.label2.Text = "to";
115 | //
116 | // ipTo
117 | //
118 | this.ipTo.AllowInternalTab = false;
119 | this.ipTo.AutoHeight = true;
120 | this.ipTo.BackColor = System.Drawing.SystemColors.Window;
121 | this.ipTo.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
122 | this.ipTo.Cursor = System.Windows.Forms.Cursors.IBeam;
123 | this.ipTo.Location = new System.Drawing.Point(208, 6);
124 | this.ipTo.MinimumSize = new System.Drawing.Size(87, 20);
125 | this.ipTo.Name = "ipTo";
126 | this.ipTo.ReadOnly = false;
127 | this.ipTo.Size = new System.Drawing.Size(112, 20);
128 | this.ipTo.TabIndex = 3;
129 | this.ipTo.Text = "192.168.0.254";
130 | //
131 | // btnScan
132 | //
133 | this.btnScan.Location = new System.Drawing.Point(326, 3);
134 | this.btnScan.Name = "btnScan";
135 | this.btnScan.Size = new System.Drawing.Size(75, 23);
136 | this.btnScan.TabIndex = 5;
137 | this.btnScan.Text = "Scan";
138 | this.btnScan.UseVisualStyleBackColor = true;
139 | this.btnScan.Click += new System.EventHandler(this.btnScan_Click);
140 | //
141 | // btnAnalyzeSelected
142 | //
143 | this.btnAnalyzeSelected.Location = new System.Drawing.Point(486, 4);
144 | this.btnAnalyzeSelected.Name = "btnAnalyzeSelected";
145 | this.btnAnalyzeSelected.Size = new System.Drawing.Size(126, 23);
146 | this.btnAnalyzeSelected.TabIndex = 6;
147 | this.btnAnalyzeSelected.Text = "Analyze Selected";
148 | this.btnAnalyzeSelected.UseVisualStyleBackColor = true;
149 | this.btnAnalyzeSelected.Click += new System.EventHandler(this.btnAnalyzeSelected_Click);
150 | //
151 | // btnRanges
152 | //
153 | this.btnRanges.Location = new System.Drawing.Point(407, 3);
154 | this.btnRanges.Name = "btnRanges";
155 | this.btnRanges.Size = new System.Drawing.Size(73, 23);
156 | this.btnRanges.TabIndex = 7;
157 | this.btnRanges.Text = "[Ranges]";
158 | this.btnRanges.UseVisualStyleBackColor = true;
159 | this.btnRanges.Click += new System.EventHandler(this.btnRanges_Click);
160 | //
161 | // IPScannerForm
162 | //
163 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
164 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
165 | this.ClientSize = new System.Drawing.Size(624, 262);
166 | this.Controls.Add(this.btnRanges);
167 | this.Controls.Add(this.btnAnalyzeSelected);
168 | this.Controls.Add(this.btnScan);
169 | this.Controls.Add(this.label2);
170 | this.Controls.Add(this.ipTo);
171 | this.Controls.Add(this.label1);
172 | this.Controls.Add(this.ipFrom);
173 | this.Controls.Add(this.lvIPList);
174 | this.Name = "IPScannerForm";
175 | this.Text = "LAN IP Scanner";
176 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IPScannerForm_FormClosing);
177 | this.ResumeLayout(false);
178 | this.PerformLayout();
179 |
180 | }
181 |
182 | #endregion
183 |
184 | private System.Windows.Forms.ListView lvIPList;
185 | private IPAddressControlLib.IPAddressControl ipFrom;
186 | private System.Windows.Forms.Label label1;
187 | private System.Windows.Forms.Label label2;
188 | private IPAddressControlLib.IPAddressControl ipTo;
189 | private System.Windows.Forms.Button btnScan;
190 | private System.Windows.Forms.ColumnHeader chIP;
191 | private System.Windows.Forms.ColumnHeader chPing;
192 | private System.Windows.Forms.ColumnHeader chHost;
193 | private System.Windows.Forms.ColumnHeader chRecognized;
194 | private System.Windows.Forms.Button btnAnalyzeSelected;
195 | private System.Windows.Forms.Button btnRanges;
196 | }
197 | }
198 |
199 |
--------------------------------------------------------------------------------
/IPScanner/IPScannerForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Windows.Forms;
9 | using System.Net;
10 | using System.Net.Sockets;
11 |
12 | namespace IPScanner
13 | {
14 | public partial class IPScannerForm : Form
15 | {
16 | NetworkScanner scanner = new NetworkScanner();
17 | Timer timer = new Timer();
18 | public IPScannerForm()
19 | {
20 | InitializeComponent();
21 | List> ipRanges = IPRanges.GetOperationalIPRanges();
22 | if (ipRanges.Count > 0)
23 | {
24 | ipFrom.IPAddress = ipRanges[0].Item1;
25 | ipTo.IPAddress = ipRanges[0].Item2;
26 | }
27 | }
28 |
29 | List results;
30 | private void btnScan_Click(object sender, EventArgs e)
31 | {
32 | timer.Stop();
33 | lvIPList.Items.Clear();
34 | results = scanner.BeginScan(ipFrom.IPAddress, ipTo.IPAddress);
35 | timer.Interval = 1000;
36 | timer.Tick += new EventHandler(timer_Tick);
37 | timer.Start();
38 | }
39 |
40 | void timer_Tick(object sender, EventArgs e)
41 | {
42 | PopulateListView();
43 | }
44 |
45 | private void PopulateListView()
46 | {
47 | bool itemModified = false;
48 | for (int i = 0; i < results.Count; i++)
49 | {
50 | IPScanResult result = results[i];
51 | if (result.status == ScanStatus.Complete || result.status == ScanStatus.Partial)
52 | {
53 | string ip = result.ip.ToString();
54 | ListViewItem[] matchedItems = lvIPList.Items.Find(ip, false);
55 | if (matchedItems.Length > 0)
56 | {
57 | matchedItems[0].Tag = result.response;
58 | matchedItems[0].SubItems[0].Text = result.ip.ToString();
59 | matchedItems[0].SubItems[1].Text = GetPingTime(result);
60 | matchedItems[0].SubItems[2].Text = result.host;
61 | matchedItems[0].SubItems[3].Text = result.identification;
62 | }
63 | else
64 | {
65 | ListViewItem lvi = new ListViewItem(new string[] { result.ip.ToString(), GetPingTime(result), result.host, result.identification });
66 | lvi.Name = ip;
67 | lvIPList.Items.Add(lvi);
68 | }
69 | itemModified = true;
70 | }
71 | }
72 | }
73 |
74 | private string GetPingTime(IPScanResult result)
75 | {
76 | if (result.ping > -1)
77 | return result.ping + " ms";
78 | return "N/A";
79 | }
80 |
81 | private void IPScannerForm_FormClosing(object sender, FormClosingEventArgs e)
82 | {
83 | timer.Stop();
84 | scanner.Abort();
85 | }
86 |
87 | private void btnAnalyzeSelected_Click(object sender, EventArgs e)
88 | {
89 | foreach (ListViewItem item in lvIPList.SelectedItems)
90 | {
91 | if (item.Tag != null)
92 | {
93 | HttpResponseData response = (HttpResponseData)item.Tag;
94 | ResponseAnalyze ra = new ResponseAnalyze(response);
95 | ra.Show();
96 | }
97 | }
98 | }
99 |
100 | private void btnRanges_Click(object sender, EventArgs e)
101 | {
102 | RangeSelector rs = new RangeSelector();
103 | rs.ShowDialog();
104 | if (rs.selectedRange != null)
105 | {
106 | ipFrom.IPAddress = rs.selectedRange.Item1;
107 | ipTo.IPAddress = rs.selectedRange.Item2;
108 | }
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/IPScanner/IPScannerForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/IPScanner/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace IPScanner
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// The main entry point for the application.
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new IPScannerForm());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/IPScanner/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("IPScanner")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("IPScanner")]
13 | [assembly: AssemblyCopyright("Copyright © 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("bd268f83-3fbb-4ee5-b81a-37a900caf233")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/IPScanner/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1008
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace IPScanner.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("IPScanner.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/IPScanner/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/IPScanner/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.1008
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace IPScanner.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/IPScanner/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/IPScanner/RangeSelector.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace IPScanner
2 | {
3 | partial class RangeSelector
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.lvRanges = new System.Windows.Forms.ListView();
33 | this.SuspendLayout();
34 | //
35 | // label1
36 | //
37 | this.label1.AutoSize = true;
38 | this.label1.Location = new System.Drawing.Point(12, 9);
39 | this.label1.Name = "label1";
40 | this.label1.Size = new System.Drawing.Size(91, 13);
41 | this.label1.TabIndex = 0;
42 | this.label1.Text = "Click an IP range:";
43 | //
44 | // lvRanges
45 | //
46 | this.lvRanges.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
47 | | System.Windows.Forms.AnchorStyles.Left)
48 | | System.Windows.Forms.AnchorStyles.Right)));
49 | this.lvRanges.Location = new System.Drawing.Point(12, 29);
50 | this.lvRanges.MultiSelect = false;
51 | this.lvRanges.Name = "lvRanges";
52 | this.lvRanges.Size = new System.Drawing.Size(260, 220);
53 | this.lvRanges.TabIndex = 1;
54 | this.lvRanges.UseCompatibleStateImageBehavior = false;
55 | this.lvRanges.View = System.Windows.Forms.View.List;
56 | this.lvRanges.SelectedIndexChanged += new System.EventHandler(this.lvRanges_SelectedIndexChanged);
57 | //
58 | // RangeSelector
59 | //
60 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
61 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
62 | this.ClientSize = new System.Drawing.Size(284, 261);
63 | this.Controls.Add(this.lvRanges);
64 | this.Controls.Add(this.label1);
65 | this.Name = "RangeSelector";
66 | this.Text = "RangeSelector";
67 | this.ResumeLayout(false);
68 | this.PerformLayout();
69 |
70 | }
71 |
72 | #endregion
73 |
74 | private System.Windows.Forms.Label label1;
75 | private System.Windows.Forms.ListView lvRanges;
76 | }
77 | }
--------------------------------------------------------------------------------
/IPScanner/RangeSelector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Net;
8 | using System.Text;
9 | using System.Windows.Forms;
10 |
11 | namespace IPScanner
12 | {
13 | public partial class RangeSelector : Form
14 | {
15 | public Tuple selectedRange = null;
16 | public RangeSelector()
17 | {
18 | InitializeComponent();
19 | foreach (Tuple range in IPRanges.GetOperationalIPRanges())
20 | {
21 | ListViewItem item = new ListViewItem();
22 | item.Tag = range;
23 | item.Text = range.Item1.ToString() + " - " + range.Item2.ToString();
24 | lvRanges.Items.Add(item);
25 | }
26 | }
27 |
28 | private void lvRanges_SelectedIndexChanged(object sender, EventArgs e)
29 | {
30 | selectedRange = (Tuple)lvRanges.SelectedItems[0].Tag;
31 | this.Close();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/IPScanner/RangeSelector.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/IPScanner/ResponseAnalyze.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace IPScanner
2 | {
3 | partial class ResponseAnalyze
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.txtHeaders = new System.Windows.Forms.TextBox();
32 | this.txtBody = new System.Windows.Forms.TextBox();
33 | this.btnOpenInBrowser = new System.Windows.Forms.Button();
34 | this.SuspendLayout();
35 | //
36 | // txtHeaders
37 | //
38 | this.txtHeaders.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
39 | | System.Windows.Forms.AnchorStyles.Right)));
40 | this.txtHeaders.Location = new System.Drawing.Point(12, 31);
41 | this.txtHeaders.Multiline = true;
42 | this.txtHeaders.Name = "txtHeaders";
43 | this.txtHeaders.Size = new System.Drawing.Size(549, 131);
44 | this.txtHeaders.TabIndex = 0;
45 | this.txtHeaders.DoubleClick += new System.EventHandler(this.txtHeaders_DoubleClick);
46 | //
47 | // txtBody
48 | //
49 | this.txtBody.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
50 | | System.Windows.Forms.AnchorStyles.Left)
51 | | System.Windows.Forms.AnchorStyles.Right)));
52 | this.txtBody.Location = new System.Drawing.Point(12, 168);
53 | this.txtBody.Multiline = true;
54 | this.txtBody.Name = "txtBody";
55 | this.txtBody.Size = new System.Drawing.Size(549, 159);
56 | this.txtBody.TabIndex = 1;
57 | this.txtBody.DoubleClick += new System.EventHandler(this.txtBody_DoubleClick);
58 | //
59 | // btnOpenInBrowser
60 | //
61 | this.btnOpenInBrowser.Location = new System.Drawing.Point(390, 2);
62 | this.btnOpenInBrowser.Name = "btnOpenInBrowser";
63 | this.btnOpenInBrowser.Size = new System.Drawing.Size(171, 23);
64 | this.btnOpenInBrowser.TabIndex = 2;
65 | this.btnOpenInBrowser.Text = "Open in Browser";
66 | this.btnOpenInBrowser.UseVisualStyleBackColor = true;
67 | this.btnOpenInBrowser.Click += new System.EventHandler(this.btnOpenInBrowser_Click);
68 | //
69 | // ResponseAnalyze
70 | //
71 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
72 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
73 | this.ClientSize = new System.Drawing.Size(573, 339);
74 | this.Controls.Add(this.btnOpenInBrowser);
75 | this.Controls.Add(this.txtBody);
76 | this.Controls.Add(this.txtHeaders);
77 | this.Name = "ResponseAnalyze";
78 | this.Text = "Response Analysis";
79 | this.ResumeLayout(false);
80 | this.PerformLayout();
81 |
82 | }
83 |
84 | #endregion
85 |
86 | private System.Windows.Forms.TextBox txtHeaders;
87 | private System.Windows.Forms.TextBox txtBody;
88 | private System.Windows.Forms.Button btnOpenInBrowser;
89 | }
90 | }
--------------------------------------------------------------------------------
/IPScanner/ResponseAnalyze.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Diagnostics;
6 | using System.Drawing;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Windows.Forms;
10 |
11 | namespace IPScanner
12 | {
13 | public partial class ResponseAnalyze : Form
14 | {
15 | string url = "";
16 | public ResponseAnalyze(HttpResponseData response)
17 | {
18 | InitializeComponent();
19 | txtHeaders.Text = string.Join(Environment.NewLine, response.headers.Select(kvp => { return kvp.Key + ": " + kvp.Value; }));
20 | txtBody.Text = response.data;
21 | this.Text = "Analysis: " + response.host;
22 | url = response.host;
23 | }
24 |
25 | private void txtBody_DoubleClick(object sender, EventArgs e)
26 | {
27 | txtBody.SelectAll();
28 | }
29 |
30 | private void txtHeaders_DoubleClick(object sender, EventArgs e)
31 | {
32 | txtHeaders.SelectAll();
33 | }
34 |
35 | private void btnOpenInBrowser_Click(object sender, EventArgs e)
36 | {
37 | Process.Start(url);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/IPScanner/ResponseAnalyze.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/IPScanner/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/IPScanner/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/IPScannerLib/HiResTimer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Runtime.InteropServices;
5 |
6 | namespace IPScanner
7 | {
8 | public class HiResTimer
9 | {
10 | private bool isPerfCounterSupported = false;
11 | private Int64 frequency = 0;
12 |
13 | // Windows CE native library with QueryPerformanceCounter().
14 | private const string lib = "Kernel32.dll";
15 | [DllImport(lib)]
16 | private static extern int QueryPerformanceCounter(ref Int64 count);
17 | [DllImport(lib)]
18 | private static extern int QueryPerformanceFrequency(ref Int64 frequency);
19 |
20 | public HiResTimer()
21 | {
22 | // Query the high-resolution timer only if it is supported.
23 | // A returned frequency of 1000 typically indicates that it is not
24 | // supported and is emulated by the OS using the same value that is
25 | // returned by Environment.TickCount.
26 | // A return value of 0 indicates that the performance counter is
27 | // not supported.
28 | int returnVal = QueryPerformanceFrequency(ref frequency);
29 |
30 | if (returnVal != 0 && frequency != 1000)
31 | {
32 | // The performance counter is supported.
33 | isPerfCounterSupported = true;
34 | }
35 | else
36 | {
37 | // The performance counter is not supported. Use
38 | // Environment.TickCount instead.
39 | frequency = 1000;
40 | }
41 | }
42 |
43 | private Int64 Frequency
44 | {
45 | get
46 | {
47 | return frequency;
48 | }
49 | }
50 |
51 | private Int64 Value
52 | {
53 | get
54 | {
55 | if (isPerfCounterSupported)
56 | {
57 | // Get the value here if the counter is supported.
58 | Int64 tickCount = 0;
59 | QueryPerformanceCounter(ref tickCount);
60 | return tickCount;
61 | }
62 | else
63 | {
64 | // Otherwise, use Environment.TickCount.
65 | return (Int64)Environment.TickCount;
66 | }
67 | }
68 | }
69 |
70 | private Int64 start;
71 | private bool isRunning = false;
72 | private double elapsedMillisecondsAtTimeOfStop = 0;
73 | public double ElapsedMilliseconds
74 | {
75 | get
76 | {
77 | if (isRunning)
78 | {
79 | Int64 timeElapsedInTicks = Value - start;
80 | return (timeElapsedInTicks * 1000) / Frequency;
81 | }
82 | else
83 | return elapsedMillisecondsAtTimeOfStop;
84 | }
85 | }
86 | public void Start()
87 | {
88 | start = Value;
89 | isRunning = true;
90 | }
91 | public void Stop()
92 | {
93 | if (!isRunning)
94 | return;
95 | elapsedMillisecondsAtTimeOfStop = ElapsedMilliseconds;
96 | isRunning = false;
97 | }
98 | public void Reset()
99 | {
100 | isRunning = false;
101 | elapsedMillisecondsAtTimeOfStop = 0;
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/IPScannerLib/HttpHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Net;
5 | using System.IO;
6 | using System.Threading;
7 | using System.Reflection;
8 | using System.Net.Configuration;
9 |
10 | namespace IPScanner
11 | {
12 | public class HttpResponseData
13 | {
14 | public string data;
15 | public SortedList headers;
16 | public string host;
17 | public HttpResponseData(string data, SortedList headers, string host)
18 | {
19 | this.data = data;
20 | this.headers = headers;
21 | this.host = host;
22 | }
23 | public string GetHeaderValue(string key)
24 | {
25 | string val;
26 | if (headers.TryGetValue(key.ToLower(), out val))
27 | return val;
28 | return "";
29 | }
30 | }
31 | internal static class HttpHelper
32 | {
33 | static HttpHelper()
34 | {
35 | ToggleAllowUnsafeHeaderParsing(true);
36 | }
37 | public static HttpResponseData GetHttpResponseData(string url)
38 | {
39 | SortedList headers = new SortedList();
40 | //return new HttpResponseData("", headers, url);
41 | byte[] data = GetData(url, headers);
42 | return new HttpResponseData(UTF8Encoding.UTF8.GetString(data), headers, url);
43 | }
44 | ///
45 | /// Gets data from a URL and returns it as a byte array.
46 | ///
47 | ///
48 | ///
49 | public static byte[] GetData(string url, SortedList headers = null, string user = "", string password = "", bool keepAlive = false)
50 | {
51 | try
52 | {
53 | if (url.Contains(".80"))
54 | {
55 | Console.WriteLine(url);
56 | }
57 | HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
58 | webRequest.Proxy = null;
59 | webRequest.KeepAlive = keepAlive;
60 | webRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
61 |
62 | if (!string.IsNullOrEmpty(user) || !string.IsNullOrEmpty(password))
63 | {
64 | string authInfo = user + ":" + password;
65 | authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
66 | webRequest.Headers["Authorization"] = "Basic " + authInfo;
67 | }
68 | webRequest.Method = "GET";
69 | webRequest.Timeout = 5000;
70 | webRequest.AllowAutoRedirect = true;
71 | return GetResponse(webRequest, headers);
72 | }
73 | catch (ThreadAbortException ex) { throw ex; }
74 | catch (WebException ex)
75 | {
76 | if (ex.Message.StartsWith("The server committed a protocol violation"))
77 | return UTF8Encoding.UTF8.GetBytes(ex.Message);
78 | if (ex.Message == "The remote server returned an error: (404) Not Found." || ex.Message == "The remote server returned an error: (401) Unauthorized.")
79 | {
80 |
81 | //if(ex.Response.ResponseUri.AbsolutePath == "/nocookies.html")
82 | try
83 | {
84 | return GetResponseData(ex.Response, headers);
85 | }
86 | catch (ThreadAbortException e) { throw e; }
87 | catch (Exception e)
88 | {
89 | if (url.Contains(".80"))
90 | {
91 | Console.WriteLine(e.ToString());
92 | }
93 | }
94 | }
95 | //else if (ex.Message == "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel." && url.StartsWith("http:"))
96 | //{
97 | // url = "https" + url.Substring(4);
98 | // return GetData(url, headers, user, password, keepAlive);
99 | //}
100 | }
101 | catch (Exception ex)
102 | {
103 | if (url.Contains(".80"))
104 | {
105 | Console.WriteLine(ex.ToString());
106 | }
107 | }
108 | return new byte[0];
109 | }
110 | private static byte[] GetResponse(HttpWebRequest webRequest, SortedList headers = null)
111 | {
112 | return GetResponseData((HttpWebResponse)webRequest.GetResponse(), headers);
113 | }
114 |
115 | private static byte[] GetResponseData(WebResponse webResponseObj, SortedList headers = null)
116 | {
117 | byte[] data;
118 | using (HttpWebResponse webResponse = (HttpWebResponse)webResponseObj)
119 | {
120 | using (MemoryStream ms = new MemoryStream())
121 | {
122 | using (Stream responseStream = webResponse.GetResponseStream())
123 | {
124 | // Dump the response stream into the MemoryStream ms
125 | int bytesRead = 1;
126 | while (bytesRead > 0)
127 | {
128 | byte[] buffer = new byte[8000];
129 | bytesRead = responseStream.Read(buffer, 0, buffer.Length);
130 | if (bytesRead > 0)
131 | ms.Write(buffer, 0, bytesRead);
132 | }
133 | data = new byte[ms.Length];
134 |
135 | // Dump the data into the byte array
136 | ms.Seek(0, SeekOrigin.Begin);
137 | ms.Read(data, 0, data.Length);
138 | responseStream.Close();
139 |
140 | if (headers != null)
141 | foreach (string key in webResponse.Headers.AllKeys)
142 | headers[key.ToLower()] = webResponse.Headers[key];
143 | }
144 | }
145 | webResponse.Close();
146 | }
147 | return data;
148 | }
149 |
150 | ///
151 | /// Enable/disable useUnsafeHeaderParsing.
152 | /// See http://o2platform.wordpress.com/2010/10/20/dealing-with-the-server-committed-a-protocol-violation-sectionresponsestatusline/
153 | ///
154 | ///
155 | ///
156 | public static bool ToggleAllowUnsafeHeaderParsing(bool enable)
157 | {
158 | //Get the assembly that contains the internal class
159 | Assembly assembly = Assembly.GetAssembly(typeof(SettingsSection));
160 | if (assembly != null)
161 | {
162 | //Use the assembly in order to get the internal type for the internal class
163 | Type settingsSectionType = assembly.GetType("System.Net.Configuration.SettingsSectionInternal");
164 | if (settingsSectionType != null)
165 | {
166 | //Use the internal static property to get an instance of the internal settings class.
167 | //If the static instance isn't created already invoking the property will create it for us.
168 | object anInstance = settingsSectionType.InvokeMember("Section", BindingFlags.Static | BindingFlags.GetProperty | BindingFlags.NonPublic, null, null, new object[] { });
169 | if (anInstance != null)
170 | {
171 | //Locate the private bool field that tells the framework if unsafe header parsing is allowed
172 | FieldInfo aUseUnsafeHeaderParsing = settingsSectionType.GetField("useUnsafeHeaderParsing", BindingFlags.NonPublic | BindingFlags.Instance);
173 | if (aUseUnsafeHeaderParsing != null)
174 | {
175 | aUseUnsafeHeaderParsing.SetValue(anInstance, enable);
176 | return true;
177 | }
178 |
179 | }
180 | }
181 | }
182 | return false;
183 | }
184 | }
185 | }
186 |
--------------------------------------------------------------------------------
/IPScannerLib/IPScanResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Net;
5 |
6 | namespace IPScanner
7 | {
8 | public class IPScanResult
9 | {
10 | public IPAddress ip;
11 | public int ping = -1;
12 | public string host;
13 | public ScanStatus status = ScanStatus.Initializing;
14 | public string identification = "...";
15 | public HttpResponseData response;
16 |
17 | public IPScanResult(IPAddress ip)
18 | {
19 | this.ip = ip;
20 | }
21 | //public IPScanResult(IPAddress ip, int ping, string host)
22 | //{
23 | // this.ip = ip;
24 | // this.ping = ping;
25 | // this.host = host;
26 | // this.status = ScanStatus.Complete;
27 | //}
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/IPScannerLib/IPScannerLib.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {BBA2E4E7-6448-44D5-A141-3E5A8DA1BEDC}
9 | Library
10 | Properties
11 | IPScanner
12 | IPScannerLib
13 | v2.0
14 | 512
15 |
16 |
17 |
18 | true
19 | bin\x86\Debug\
20 | DEBUG;TRACE
21 | full
22 | x86
23 | prompt
24 | MinimumRecommendedRules.ruleset
25 |
26 |
27 | bin\x86\Release\
28 | TRACE
29 | true
30 | pdbonly
31 | x86
32 | prompt
33 | MinimumRecommendedRules.ruleset
34 |
35 |
36 |
37 | SmartThreadPool.dll
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
67 |
--------------------------------------------------------------------------------
/IPScannerLib/NetworkScanner.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Net;
5 | using System.Net.Sockets;
6 | using Amib.Threading;
7 | using System.Net.NetworkInformation;
8 | using System.Text.RegularExpressions;
9 | using System.Diagnostics;
10 |
11 | namespace IPScanner
12 | {
13 | public class NetworkScanner
14 | {
15 | private static Regex rxHtmlTitle = new Regex("([^<]+?)", RegexOptions.Compiled);
16 | SmartThreadPool Pool = new SmartThreadPool(1000, 256, 0);
17 | public NetworkScanner()
18 | {
19 | ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
20 | System.Net.ServicePointManager.MaxServicePoints = int.MaxValue;
21 | }
22 |
23 | public List BeginScan(IPAddress ipFrom, IPAddress ipTo)
24 | {
25 | Amib.Threading.Action, int> ipScanAction = new Amib.Threading.Action, int>(ScanIPAsync);
26 | // Count the IP addresses included in this range
27 | byte[] addyEnd = ipTo.GetAddressBytes();
28 | byte[] addyNext = ipFrom.GetAddressBytes();
29 |
30 | List Results = new List();
31 | while (CompareIPs(addyNext, addyEnd) < 1)
32 | {
33 | Results.Add(new IPScanResult(new IPAddress(addyNext)));
34 | IncrementIP(addyNext);
35 | }
36 |
37 | for (int i = 0; i < Results.Count; i++)
38 | Pool.QueueWorkItem(ipScanAction, Results[i].ip, Results, i);
39 | return Results;
40 | }
41 | private void ScanIPAsync(IPAddress ip, List results, int listIndex)
42 | {
43 | bool foundHost = false;
44 | results[listIndex].status = ScanStatus.Initializing;
45 |
46 | // Attempt Ordinary Ping
47 | try
48 | {
49 | using (Ping p = new Ping())
50 | {
51 | PingReply pingReply = p.Send(ip, 5000);
52 | if (pingReply.Status == IPStatus.Success)
53 | {
54 | foundHost = true;
55 | results[listIndex].status = ScanStatus.Partial;
56 | results[listIndex].ping = (int)pingReply.RoundtripTime;
57 | }
58 | }
59 | }
60 | catch (SocketException)
61 | {
62 | }
63 | catch (Exception)
64 | {
65 | }
66 |
67 | // Attempt DNS Lookup
68 | try
69 | {
70 | Stopwatch timer = new Stopwatch();
71 | timer.Start();
72 | IPHostEntry ipe = Dns.GetHostEntry(ip);
73 | timer.Stop();
74 | int dnsLookupTime = (int)timer.ElapsedMilliseconds;
75 |
76 | foundHost = true;
77 | //if (results[listIndex].ping < 0 || dnsLookupTime < results[listIndex].ping)
78 | // results[listIndex].ping = dnsLookupTime;
79 | results[listIndex].host = ipe.HostName.ToString();
80 | results[listIndex].status = ScanStatus.Complete;
81 | }
82 | //catch (SocketException ex)
83 | //{
84 | // //if (ex.SocketErrorCode == SocketError.HostNotFound)
85 | // // return;
86 | // Console.WriteLine(ex.Message);
87 | //}
88 | catch (Exception)
89 | {
90 | }
91 |
92 |
93 |
94 | if (foundHost)
95 | {
96 | // Try to identify
97 | HttpResponseData response;
98 | results[listIndex].identification = IdentifyHost(ip, out response);
99 | results[listIndex].status = ScanStatus.Complete;
100 | results[listIndex].response = response;
101 | }
102 | else
103 | results[listIndex].status = ScanStatus.NotFound;
104 | }
105 |
106 | private string IdentifyHost(IPAddress ip, out HttpResponseData response)
107 | {
108 | response = null;
109 | Stopwatch sw = new Stopwatch();
110 | try
111 | {
112 | sw.Start();
113 | response = HttpHelper.GetHttpResponseData("http://" + ip.ToString() + "/");
114 | if (response.GetHeaderValue("server").StartsWith("lighttpd") && response.GetHeaderValue("set-cookie").Contains("AIROS_") && response.data.Contains("Error 404"))
115 | return "Ubiquiti";
116 | else if (response.GetHeaderValue("server").StartsWith("Boa") && response.data.Contains(""))
129 | return "Netgear FS728TP";
130 | else if (response.GetHeaderValue("set-cookie").Contains("DLILPC=") && response.data.Contains("Power Controller"))
131 | return "Web Power Switch";
132 | else if (response.data == "The server committed a protocol violation. Section=ResponseStatusLine")
133 | return "? WeatherDirect ?";
134 | else if (response.data == "The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF")
135 | return "? Web Power Switch ?";
136 | else if (response.data.Contains("NetDAQ ND-100"))
137 | return "NetDAQ ND-100";
138 | else if (response.GetHeaderValue("server") == "nginx" && response.data.Contains("airVision:"))
139 | return "AirVision NVR";
140 | else if (response.GetHeaderValue("server") == "nginx" && response.data.Contains("airVision:"))
141 | return "AirVision NVR";
142 | else if (response.GetHeaderValue("server").StartsWith("BlueIris-"))
143 | return "Blue Iris";
144 | //else if (response.data.Contains("iTach"))
145 | // return "iTach";
146 | else if (response.data.Contains("href=\"/cmh\""))
147 | return "Vera";
148 | else if (response.data.Contains("WDMyCloud"))
149 | return "WDMyCloud";
150 | //else if (response.data.Contains("DD-WRT"))
151 | // return "DD-WRT";
152 | else if (response.data.Contains("= \"Peplink\""))
153 | return "Peplink";
154 | else if (response.data.Contains("GSViewerX.ocx"))
155 | return "GrandStream";
156 | else if (response.data.Contains("content=\"Canon Inc.\""))
157 | return "Canon printer";
158 | else if (response.GetHeaderValue("server") == "tsbox" && response.GetHeaderValue("www-authenticate") == "Basic realm=\"pbox\"")
159 | return "HDMI Encoder";
160 | else if (response.data.Contains("Rules of login password.\\n"))
161 | return "ACTi";
162 | else if (response.data.Contains("/static/freenas_favicon.ico"))
163 | return "FreeNAS";
164 | else if (response.data.Contains("CONTENT=\"0;url=cgi-bin/kvm.cgi\""))
165 | return "Avocent KVM";
166 | else if (response.GetHeaderValue("www-authenticate") == "Basic realm=\"TomatoUSB\"")
167 | return "TomatoUSB Router";
168 | else if (response.GetHeaderValue("auther") == "Steven Wu" && response.GetHeaderValue("server") == "Camera Web Server/1.0" && response.data.Contains("location.href=\"top.htm?Currenttime=\"+timeValue;"))
169 | return "TrendNET IP cam";
170 | else if (response.data.Contains(@""))
171 | return "ESXi";
172 | else if (response.GetHeaderValue("server") == "Microsoft-HTTPAPI/2.0")
173 | return "IIS";
174 | else
175 | {
176 | Match m = rxHtmlTitle.Match(response.data);
177 | if (m.Success)
178 | return m.Groups[1].Value;
179 | string server = response.GetHeaderValue("server");
180 | if (!string.IsNullOrEmpty(server))
181 | return server;
182 | return "";
183 | }
184 | return response.data;
185 | }
186 | catch (Exception)
187 | {
188 | }
189 | finally
190 | {
191 | sw.Stop();
192 | //Console.WriteLine("Spent " + sw.ElapsedMilliseconds + " on " + response.data.Length);
193 | }
194 | return "";
195 | }
196 |
197 | public void Abort()
198 | {
199 | Pool.Cancel(true);
200 | }
201 | bool ArraysMatch(Array a1, Array a2)
202 | {
203 | if (a1.Length != a2.Length)
204 | return false;
205 | for (int i = 0; i < a1.Length; i++)
206 | if (a1.GetValue(i) != a1.GetValue(i))
207 | return false;
208 | return true;
209 | }
210 | int CompareIPs(byte[] ip1, byte[] ip2)
211 | {
212 | if (ip1 == null || ip1.Length != 4)
213 | return -1;
214 | if (ip2 == null || ip2.Length != 4)
215 | return 1;
216 | int comp = ip1[0].CompareTo(ip2[0]);
217 | if (comp == 0)
218 | comp = ip1[1].CompareTo(ip2[1]);
219 | if (comp == 0)
220 | comp = ip1[2].CompareTo(ip2[2]);
221 | if (comp == 0)
222 | comp = ip1[3].CompareTo(ip2[3]);
223 | return comp;
224 | }
225 | void IncrementIP(byte[] ip, int idx = 3)
226 | {
227 | if (ip == null || ip.Length != 4 || idx < 0)
228 | return;
229 | if (ip[idx] == 254)
230 | {
231 | ip[idx] = 1;
232 | IncrementIP(ip, idx - 1);
233 | }
234 | else
235 | ip[idx] = (byte)(ip[idx] + 1);
236 | }
237 | }
238 | }
239 |
--------------------------------------------------------------------------------
/IPScannerLib/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("IPScannerLib")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("IPScannerLib")]
13 | [assembly: AssemblyCopyright("Copyright © 2013")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a4488389-a3bf-4d66-82ad-c24a4c870019")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/IPScannerLib/ScanStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace IPScanner
6 | {
7 | public enum ScanStatus
8 | {
9 | Initializing,
10 | Scanning,
11 | NotFound,
12 | Complete,
13 | Partial
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/IPScannerLib/SmartThreadPool.XML:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SmartThreadPool
5 |
6 |
7 |
8 |
9 | IWorkItemsGroup interface
10 | Created by SmartThreadPool.CreateWorkItemsGroup()
11 |
12 |
13 |
14 |
15 | Get an array with all the state objects of the currently running items.
16 | The array represents a snap shot and impact performance.
17 |
18 |
19 |
20 |
21 | Starts to execute work items
22 |
23 |
24 |
25 |
26 | Cancel all the work items.
27 | Same as Cancel(false)
28 |
29 |
30 |
31 |
32 | Cancel all work items using thread abortion
33 |
34 | True to stop work items by raising ThreadAbortException
35 |
36 |
37 |
38 | Wait for all work item to complete.
39 |
40 |
41 |
42 |
43 | Wait for all work item to complete, until timeout expired
44 |
45 | How long to wait for the work items to complete
46 | Returns true if work items completed within the timeout, otherwise false.
47 |
48 |
49 |
50 | Wait for all work item to complete, until timeout expired
51 |
52 | How long to wait for the work items to complete in milliseconds
53 | Returns true if work items completed within the timeout, otherwise false.
54 |
55 |
56 |
57 | Queue a work item
58 |
59 | A callback to execute
60 | Returns a work item result
61 |
62 |
63 |
64 | Queue a work item
65 |
66 | A callback to execute
67 | The priority of the work item
68 | Returns a work item result
69 |
70 |
71 |
72 | Queue a work item
73 |
74 | A callback to execute
75 |
76 | The context object of the work item. Used for passing arguments to the work item.
77 |
78 | Returns a work item result
79 |
80 |
81 |
82 | Queue a work item
83 |
84 | A callback to execute
85 |
86 | The context object of the work item. Used for passing arguments to the work item.
87 |
88 | The work item priority
89 | Returns a work item result
90 |
91 |
92 |
93 | Queue a work item
94 |
95 | A callback to execute
96 |
97 | The context object of the work item. Used for passing arguments to the work item.
98 |
99 |
100 | A delegate to call after the callback completion
101 |
102 | Returns a work item result
103 |
104 |
105 |
106 | Queue a work item
107 |
108 | A callback to execute
109 |
110 | The context object of the work item. Used for passing arguments to the work item.
111 |
112 |
113 | A delegate to call after the callback completion
114 |
115 | The work item priority
116 | Returns a work item result
117 |
118 |
119 |
120 | Queue a work item
121 |
122 | A callback to execute
123 |
124 | The context object of the work item. Used for passing arguments to the work item.
125 |
126 |
127 | A delegate to call after the callback completion
128 |
129 | Indicates on which cases to call to the post execute callback
130 | Returns a work item result
131 |
132 |
133 |
134 | Queue a work item
135 |
136 | A callback to execute
137 |
138 | The context object of the work item. Used for passing arguments to the work item.
139 |
140 |
141 | A delegate to call after the callback completion
142 |
143 | Indicates on which cases to call to the post execute callback
144 | The work item priority
145 | Returns a work item result
146 |
147 |
148 |
149 | Queue a work item
150 |
151 | Work item info
152 | A callback to execute
153 | Returns a work item result
154 |
155 |
156 |
157 | Queue a work item
158 |
159 | Work item information
160 | A callback to execute
161 |
162 | The context object of the work item. Used for passing arguments to the work item.
163 |
164 | Returns a work item result
165 |
166 |
167 |
168 | Queue a work item.
169 |
170 | Returns a IWorkItemResult object, but its GetResult() will always return null
171 |
172 |
173 |
174 | Queue a work item.
175 |
176 | Returns a IWorkItemResult object, but its GetResult() will always return null
177 |
178 |
179 |
180 | Queue a work item.
181 |
182 | Returns a IWorkItemResult object, but its GetResult() will always return null
183 |
184 |
185 |
186 | Queue a work item.
187 |
188 | Returns a IWorkItemResult object, but its GetResult() will always return null
189 |
190 |
191 |
192 | Queue a work item.
193 |
194 | Returns a IWorkItemResult object, but its GetResult() will always return null
195 |
196 |
197 |
198 | Queue a work item.
199 |
200 | Returns a IWorkItemResult<TResult> object.
201 | its GetResult() returns a TResult object
202 |
203 |
204 |
205 | Queue a work item.
206 |
207 | Returns a IWorkItemResult<TResult> object.
208 | its GetResult() returns a TResult object
209 |
210 |
211 |
212 | Queue a work item.
213 |
214 | Returns a IWorkItemResult<TResult> object.
215 | its GetResult() returns a TResult object
216 |
217 |
218 |
219 | Queue a work item.
220 |
221 | Returns a IWorkItemResult<TResult> object.
222 | its GetResult() returns a TResult object
223 |
224 |
225 |
226 | Queue a work item.
227 |
228 | Returns a IWorkItemResult<TResult> object.
229 | its GetResult() returns a TResult object
230 |
231 |
232 |
233 | Get/Set the name of the WorkItemsGroup
234 |
235 |
236 |
237 |
238 | Get/Set the maximum number of workitem that execute cocurrency on the thread pool
239 |
240 |
241 |
242 |
243 | Get the number of work items waiting in the queue.
244 |
245 |
246 |
247 |
248 | Get the WorkItemsGroup start information
249 |
250 |
251 |
252 |
253 | IsIdle is true when there are no work items running or queued.
254 |
255 |
256 |
257 |
258 | This event is fired when all work items are completed.
259 | (When IsIdle changes to true)
260 | This event only work on WorkItemsGroup. On SmartThreadPool
261 | it throws the NotImplementedException.
262 |
263 |
264 |
265 |
266 | Contains the name of this instance of SmartThreadPool.
267 | Can be changed by the user.
268 |
269 |
270 |
271 |
272 | Cancel all the work items.
273 | Same as Cancel(false)
274 |
275 |
276 |
277 |
278 | Wait for the SmartThreadPool/WorkItemsGroup to be idle
279 |
280 |
281 |
282 |
283 | Wait for the SmartThreadPool/WorkItemsGroup to be idle
284 |
285 |
286 |
287 |
288 | Queue a work item
289 |
290 | A callback to execute
291 | Returns a work item result
292 |
293 |
294 |
295 | Queue a work item
296 |
297 | A callback to execute
298 | The priority of the work item
299 | Returns a work item result
300 |
301 |
302 |
303 | Queue a work item
304 |
305 | Work item info
306 | A callback to execute
307 | Returns a work item result
308 |
309 |
310 |
311 | Queue a work item
312 |
313 | A callback to execute
314 |
315 | The context object of the work item. Used for passing arguments to the work item.
316 |
317 | Returns a work item result
318 |
319 |
320 |
321 | Queue a work item
322 |
323 | A callback to execute
324 |
325 | The context object of the work item. Used for passing arguments to the work item.
326 |
327 | The work item priority
328 | Returns a work item result
329 |
330 |
331 |
332 | Queue a work item
333 |
334 | Work item information
335 | A callback to execute
336 |
337 | The context object of the work item. Used for passing arguments to the work item.
338 |
339 | Returns a work item result
340 |
341 |
342 |
343 | Queue a work item
344 |
345 | A callback to execute
346 |
347 | The context object of the work item. Used for passing arguments to the work item.
348 |
349 |
350 | A delegate to call after the callback completion
351 |
352 | Returns a work item result
353 |
354 |
355 |
356 | Queue a work item
357 |
358 | A callback to execute
359 |
360 | The context object of the work item. Used for passing arguments to the work item.
361 |
362 |
363 | A delegate to call after the callback completion
364 |
365 | The work item priority
366 | Returns a work item result
367 |
368 |
369 |
370 | Queue a work item
371 |
372 | A callback to execute
373 |
374 | The context object of the work item. Used for passing arguments to the work item.
375 |
376 |
377 | A delegate to call after the callback completion
378 |
379 | Indicates on which cases to call to the post execute callback
380 | Returns a work item result
381 |
382 |
383 |
384 | Queue a work item
385 |
386 | A callback to execute
387 |
388 | The context object of the work item. Used for passing arguments to the work item.
389 |
390 |
391 | A delegate to call after the callback completion
392 |
393 | Indicates on which cases to call to the post execute callback
394 | The work item priority
395 | Returns a work item result
396 |
397 |
398 |
399 | Get/Set the name of the SmartThreadPool/WorkItemsGroup instance
400 |
401 |
402 |
403 |
404 | IsIdle is true when there are no work items running or queued.
405 |
406 |
407 |
408 |
409 | Summary description for STPStartInfo.
410 |
411 |
412 |
413 |
414 | Summary description for WIGStartInfo.
415 |
416 |
417 |
418 |
419 | Get a readonly version of this WIGStartInfo
420 |
421 | Returns a readonly reference to this WIGStartInfoRO
422 |
423 |
424 |
425 | Get/Set if to use the caller's security context
426 |
427 |
428 |
429 |
430 | Get/Set if to use the caller's HTTP context
431 |
432 |
433 |
434 |
435 | Get/Set if to dispose of the state object of a work item
436 |
437 |
438 |
439 |
440 | Get/Set the run the post execute options
441 |
442 |
443 |
444 |
445 | Get/Set the default post execute callback
446 |
447 |
448 |
449 |
450 | Get/Set if the work items execution should be suspended until the Start()
451 | method is called.
452 |
453 |
454 |
455 |
456 | Get/Set the default priority that a work item gets when it is enqueued
457 |
458 |
459 |
460 |
461 | Get/Set the if QueueWorkItem of Action<...>/Func<...> fill the
462 | arguments as an object array into the state of the work item.
463 | The arguments can be access later by IWorkItemResult.State.
464 |
465 |
466 |
467 |
468 | Get a readonly version of this STPStartInfo.
469 |
470 | Returns a readonly reference to this STPStartInfo
471 |
472 |
473 |
474 | Get/Set the idle timeout in milliseconds.
475 | If a thread is idle (starved) longer than IdleTimeout then it may quit.
476 |
477 |
478 |
479 |
480 | Get/Set the lower limit of threads in the pool.
481 |
482 |
483 |
484 |
485 | Get/Set the upper limit of threads in the pool.
486 |
487 |
488 |
489 |
490 | Get/Set the scheduling priority of the threads in the pool.
491 | The Os handles the scheduling.
492 |
493 |
494 |
495 |
496 | Get/Set the thread pool name. Threads will get names depending on this.
497 |
498 |
499 |
500 |
501 | Get/Set the performance counter instance name of this SmartThreadPool
502 | The default is null which indicate not to use performance counters at all.
503 |
504 |
505 |
506 |
507 | Enable/Disable the local performance counter.
508 | This enables the user to get some performance information about the SmartThreadPool
509 | without using Windows performance counters. (Useful on WindowsCE, Silverlight, etc.)
510 | The default is false.
511 |
512 |
513 |
514 |
515 | Get/Set backgroundness of thread in thread pool.
516 |
517 |
518 |
519 |
520 | Get/Set the apartment state of threads in the thread pool
521 |
522 |
523 |
524 |
525 | Get/Set the max stack size of threads in the thread pool
526 |
527 |
528 |
529 |
530 | PriorityQueue class
531 | This class is not thread safe because we use external lock
532 |
533 |
534 |
535 |
536 | The number of queues, there is one for each type of priority
537 |
538 |
539 |
540 |
541 | Work items queues. There is one for each type of priority
542 |
543 |
544 |
545 |
546 | The total number of work items within the queues
547 |
548 |
549 |
550 |
551 | Use with IEnumerable interface
552 |
553 |
554 |
555 |
556 | Enqueue a work item.
557 |
558 | A work item
559 |
560 |
561 |
562 | Dequeque a work item.
563 |
564 | Returns the next work item
565 |
566 |
567 |
568 | Find the next non empty queue starting at queue queueIndex+1
569 |
570 | The index-1 to start from
571 |
572 | The index of the next non empty queue or -1 if all the queues are empty
573 |
574 |
575 |
576 |
577 | Clear all the work items
578 |
579 |
580 |
581 |
582 | Returns an enumerator to iterate over the work items
583 |
584 | Returns an enumerator
585 |
586 |
587 |
588 | The number of work items
589 |
590 |
591 |
592 |
593 | The class the implements the enumerator
594 |
595 |
596 |
597 |
598 | WorkItemsQueue class.
599 |
600 |
601 |
602 |
603 | Waiters queue (implemented as stack).
604 |
605 |
606 |
607 |
608 | Waiters count
609 |
610 |
611 |
612 |
613 | Work items queue
614 |
615 |
616 |
617 |
618 | Indicate that work items are allowed to be queued
619 |
620 |
621 |
622 |
623 | A flag that indicates if the WorkItemsQueue has been disposed.
624 |
625 |
626 |
627 |
628 | Enqueue a work item to the queue.
629 |
630 |
631 |
632 |
633 | Waits for a work item or exits on timeout or cancel
634 |
635 | Timeout in milliseconds
636 | Cancel wait handle
637 | Returns true if the resource was granted
638 |
639 |
640 |
641 | Cleanup the work items queue, hence no more work
642 | items are allowed to be queue
643 |
644 |
645 |
646 |
647 | Returns the WaiterEntry of the current thread
648 |
649 |
650 | In order to avoid creation and destuction of WaiterEntry
651 | objects each thread has its own WaiterEntry object.
652 |
653 |
654 |
655 | Push a new waiter into the waiter's stack
656 |
657 | A waiter to put in the stack
658 |
659 |
660 |
661 | Pop a waiter from the waiter's stack
662 |
663 | Returns the first waiter in the stack
664 |
665 |
666 |
667 | Remove a waiter from the stack
668 |
669 | A waiter entry to remove
670 | If true the waiter count is always decremented
671 |
672 |
673 |
674 | Each thread in the thread pool keeps its own waiter entry.
675 |
676 |
677 |
678 |
679 | Returns the current number of work items in the queue
680 |
681 |
682 |
683 |
684 | Returns the current number of waiters
685 |
686 |
687 |
688 |
689 | Event to signal the waiter that it got the work item.
690 |
691 |
692 |
693 |
694 | Flag to know if this waiter already quited from the queue
695 | because of a timeout.
696 |
697 |
698 |
699 |
700 | Flag to know if the waiter was signaled and got a work item.
701 |
702 |
703 |
704 |
705 | A work item that passed directly to the waiter withou going
706 | through the queue
707 |
708 |
709 |
710 |
711 | Signal the waiter that it got a work item.
712 |
713 | Return true on success
714 | The method fails if Timeout() preceded its call
715 |
716 |
717 |
718 | Mark the wait entry that it has been timed out
719 |
720 | Return true on success
721 | The method fails if Signal() preceded its call
722 |
723 |
724 |
725 | Reset the wait entry so it can be used again
726 |
727 |
728 |
729 |
730 | Free resources
731 |
732 |
733 |
734 |
735 | IWorkItemResult<TResult> interface.
736 | Created when a Func<TResult> work item is queued.
737 |
738 |
739 |
740 |
741 | The common interface of IWorkItemResult and IWorkItemResult<T>
742 |
743 |
744 |
745 |
746 | This method intent is for internal use.
747 |
748 |
749 |
750 |
751 |
752 | This method intent is for internal use.
753 |
754 |
755 |
756 |
757 |
758 | Get the result of the work item.
759 | If the work item didn't run yet then the caller waits.
760 |
761 | The result of the work item
762 |
763 |
764 |
765 | Get the result of the work item.
766 | If the work item didn't run yet then the caller waits until timeout.
767 |
768 | The result of the work item
769 | On timeout throws WorkItemTimeoutException
770 |
771 |
772 |
773 | Get the result of the work item.
774 | If the work item didn't run yet then the caller waits until timeout.
775 |
776 | The result of the work item
777 | On timeout throws WorkItemTimeoutException
778 |
779 |
780 |
781 | Get the result of the work item.
782 | If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
783 |
784 | Timeout in milliseconds, or -1 for infinite
785 |
786 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
787 |
788 | A cancel wait handle to interrupt the blocking if needed
789 | The result of the work item
790 | On timeout throws WorkItemTimeoutException
791 | On cancel throws WorkItemCancelException
792 |
793 |
794 |
795 | Get the result of the work item.
796 | If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
797 |
798 | The result of the work item
799 | On timeout throws WorkItemTimeoutException
800 | On cancel throws WorkItemCancelException
801 |
802 |
803 |
804 | Get the result of the work item.
805 | If the work item didn't run yet then the caller waits.
806 |
807 | Filled with the exception if one was thrown
808 | The result of the work item
809 |
810 |
811 |
812 | Get the result of the work item.
813 | If the work item didn't run yet then the caller waits until timeout.
814 |
815 |
816 |
817 | Filled with the exception if one was thrown
818 | The result of the work item
819 | On timeout throws WorkItemTimeoutException
820 |
821 |
822 |
823 | Get the result of the work item.
824 | If the work item didn't run yet then the caller waits until timeout.
825 |
826 |
827 | Filled with the exception if one was thrown
828 |
829 | The result of the work item
830 | On timeout throws WorkItemTimeoutException
831 |
832 |
833 |
834 | Get the result of the work item.
835 | If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
836 |
837 | Timeout in milliseconds, or -1 for infinite
838 |
839 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
840 |
841 | A cancel wait handle to interrupt the blocking if needed
842 | Filled with the exception if one was thrown
843 | The result of the work item
844 | On timeout throws WorkItemTimeoutException
845 | On cancel throws WorkItemCancelException
846 |
847 |
848 |
849 | Get the result of the work item.
850 | If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
851 |
852 | The result of the work item
853 |
854 | Filled with the exception if one was thrown
855 |
856 |
857 | On timeout throws WorkItemTimeoutException
858 | On cancel throws WorkItemCancelException
859 |
860 |
861 |
862 | Same as Cancel(false).
863 |
864 |
865 |
866 |
867 | Cancel the work item execution.
868 | If the work item is in the queue then it won't execute
869 | If the work item is completed, it will remain completed
870 | If the work item is in progress then the user can check the SmartThreadPool.IsWorkItemCanceled
871 | property to check if the work item has been cancelled. If the abortExecution is set to true then
872 | the Smart Thread Pool will send an AbortException to the running thread to stop the execution
873 | of the work item. When an in progress work item is canceled its GetResult will throw WorkItemCancelException.
874 | If the work item is already cancelled it will remain cancelled
875 |
876 | When true send an AbortException to the executing thread.
877 | Returns true if the work item was not completed, otherwise false.
878 |
879 |
880 |
881 | Gets an indication whether the asynchronous operation has completed.
882 |
883 |
884 |
885 |
886 | Gets an indication whether the asynchronous operation has been canceled.
887 |
888 |
889 |
890 |
891 | Gets the user-defined object that contains context data
892 | for the work item method.
893 |
894 |
895 |
896 |
897 | Get the work item's priority
898 |
899 |
900 |
901 |
902 | Return the result, same as GetResult()
903 |
904 |
905 |
906 |
907 | Returns the exception if occured otherwise returns null.
908 |
909 |
910 |
911 |
912 | This method is intent for internal use.
913 |
914 |
915 |
916 |
917 | Summary description for WorkItemsGroup.
918 |
919 |
920 |
921 |
922 | A reference to the SmartThreadPool instance that created this
923 | WorkItemsGroup.
924 |
925 |
926 |
927 |
928 | A flag to indicate if the Work Items Group is now suspended.
929 |
930 |
931 |
932 |
933 | Defines how many work items of this WorkItemsGroup can run at once.
934 |
935 |
936 |
937 |
938 | Priority queue to hold work items before they are passed
939 | to the SmartThreadPool.
940 |
941 |
942 |
943 |
944 | Indicate how many work items are waiting in the SmartThreadPool
945 | queue.
946 | This value is used to apply the concurrency.
947 |
948 |
949 |
950 |
951 | Indicate how many work items are currently running in the SmartThreadPool.
952 | This value is used with the Cancel, to calculate if we can send new
953 | work items to the STP.
954 |
955 |
956 |
957 |
958 | WorkItemsGroup start information
959 |
960 |
961 |
962 |
963 | Signaled when all of the WorkItemsGroup's work item completed.
964 |
965 |
966 |
967 |
968 | A common object for all the work items that this work items group
969 | generate so we can mark them to cancel in O(1)
970 |
971 |
972 |
973 |
974 | Start the Work Items Group if it was started suspended
975 |
976 |
977 |
978 |
979 | Wait for the thread pool to be idle
980 |
981 |
982 |
983 |
984 | The OnIdle event
985 |
986 |
987 |
988 |
989 | WorkItemsGroup start information
990 |
991 |
992 |
993 |
994 | A delegate that represents the method to run as the work item
995 |
996 | A state object for the method to run
997 |
998 |
999 |
1000 | A delegate to call after the WorkItemCallback completed
1001 |
1002 | The work item result object
1003 |
1004 |
1005 |
1006 | A delegate to call after the WorkItemCallback completed
1007 |
1008 | The work item result object
1009 |
1010 |
1011 |
1012 | A delegate to call when a WorkItemsGroup becomes idle
1013 |
1014 | A reference to the WorkItemsGroup that became idle
1015 |
1016 |
1017 |
1018 | A delegate to call after a thread is created, but before
1019 | it's first use.
1020 |
1021 |
1022 |
1023 |
1024 | A delegate to call when a thread is about to exit, after
1025 | it is no longer belong to the pool.
1026 |
1027 |
1028 |
1029 |
1030 | Defines the availeable priorities of a work item.
1031 | The higher the priority a work item has, the sooner
1032 | it will be executed.
1033 |
1034 |
1035 |
1036 |
1037 | Never call to the PostExecute call back
1038 |
1039 |
1040 |
1041 |
1042 | Call to the PostExecute only when the work item is cancelled
1043 |
1044 |
1045 |
1046 |
1047 | Call to the PostExecute only when the work item is not cancelled
1048 |
1049 |
1050 |
1051 |
1052 | Always call to the PostExecute
1053 |
1054 |
1055 |
1056 |
1057 | IWorkItemResult interface.
1058 | Created when a WorkItemCallback work item is queued.
1059 |
1060 |
1061 |
1062 |
1063 | Summary description for STPPerformanceCounter.
1064 |
1065 |
1066 |
1067 |
1068 | Holds a callback delegate and the state for that delegate.
1069 |
1070 |
1071 |
1072 |
1073 | Callback delegate for the callback.
1074 |
1075 |
1076 |
1077 |
1078 | State with which to call the callback delegate.
1079 |
1080 |
1081 |
1082 |
1083 | Stores the caller's context
1084 |
1085 |
1086 |
1087 |
1088 | Holds the result of the mehtod
1089 |
1090 |
1091 |
1092 |
1093 | Hold the exception if the method threw it
1094 |
1095 |
1096 |
1097 |
1098 | Hold the state of the work item
1099 |
1100 |
1101 |
1102 |
1103 | A ManualResetEvent to indicate that the result is ready
1104 |
1105 |
1106 |
1107 |
1108 | A reference count to the _workItemCompleted.
1109 | When it reaches to zero _workItemCompleted is Closed
1110 |
1111 |
1112 |
1113 |
1114 | Represents the result state of the work item
1115 |
1116 |
1117 |
1118 |
1119 | Work item info
1120 |
1121 |
1122 |
1123 |
1124 | A reference to an object that indicates whatever the
1125 | WorkItemsGroup has been canceled
1126 |
1127 |
1128 |
1129 |
1130 | A reference to an object that indicates whatever the
1131 | SmartThreadPool has been canceled
1132 |
1133 |
1134 |
1135 |
1136 | The work item group this work item belong to.
1137 |
1138 |
1139 |
1140 |
1141 | The thread that executes this workitem.
1142 | This field is available for the period when the work item is executed, before and after it is null.
1143 |
1144 |
1145 |
1146 |
1147 | The absulote time when the work item will be timeout
1148 |
1149 |
1150 |
1151 |
1152 | Stores how long the work item waited on the stp queue
1153 |
1154 |
1155 |
1156 |
1157 | Stores how much time it took the work item to execute after it went out of the queue
1158 |
1159 |
1160 |
1161 |
1162 | Initialize the callback holding object.
1163 |
1164 | The workItemGroup of the workitem
1165 | The WorkItemInfo of te workitem
1166 | Callback delegate for the callback.
1167 | State with which to call the callback delegate.
1168 |
1169 | We assume that the WorkItem object is created within the thread
1170 | that meant to run the callback
1171 |
1172 |
1173 |
1174 | Change the state of the work item to in progress if it wasn't canceled.
1175 |
1176 |
1177 | Return true on success or false in case the work item was canceled.
1178 | If the work item needs to run a post execute then the method will return true.
1179 |
1180 |
1181 |
1182 |
1183 | Execute the work item and the post execute
1184 |
1185 |
1186 |
1187 |
1188 | Execute the work item
1189 |
1190 |
1191 |
1192 |
1193 | Runs the post execute callback
1194 |
1195 |
1196 |
1197 |
1198 | Set the result of the work item to return
1199 |
1200 | The result of the work item
1201 | The exception that was throw while the workitem executed, null
1202 | if there was no exception.
1203 |
1204 |
1205 |
1206 | Returns the work item result
1207 |
1208 | The work item result
1209 |
1210 |
1211 |
1212 | Wait for all work items to complete
1213 |
1214 | Array of work item result objects
1215 | The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
1216 |
1217 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1218 |
1219 | A cancel wait handle to interrupt the wait if needed
1220 |
1221 | true when every work item in waitableResults has completed; otherwise false.
1222 |
1223 |
1224 |
1225 |
1226 | Waits for any of the work items in the specified array to complete, cancel, or timeout
1227 |
1228 | Array of work item result objects
1229 | The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
1230 |
1231 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1232 |
1233 | A cancel wait handle to interrupt the wait if needed
1234 |
1235 | The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
1236 |
1237 |
1238 |
1239 |
1240 | Fill an array of wait handles with the work items wait handles.
1241 |
1242 | An array of work item results
1243 | An array of wait handles to fill
1244 |
1245 |
1246 |
1247 | Release the work items' wait handles
1248 |
1249 | An array of work item results
1250 |
1251 |
1252 |
1253 | Sets the work item's state
1254 |
1255 | The state to set the work item to
1256 |
1257 |
1258 |
1259 | Signals that work item has been completed or canceled
1260 |
1261 | Indicates that the work item has been canceled
1262 |
1263 |
1264 |
1265 | Cancel the work item if it didn't start running yet.
1266 |
1267 | Returns true on success or false if the work item is in progress or already completed
1268 |
1269 |
1270 |
1271 | Get the result of the work item.
1272 | If the work item didn't run yet then the caller waits for the result, timeout, or cancel.
1273 | In case of error the method throws and exception
1274 |
1275 | The result of the work item
1276 |
1277 |
1278 |
1279 | Get the result of the work item.
1280 | If the work item didn't run yet then the caller waits for the result, timeout, or cancel.
1281 | In case of error the e argument is filled with the exception
1282 |
1283 | The result of the work item
1284 |
1285 |
1286 |
1287 | A wait handle to wait for completion, cancel, or timeout
1288 |
1289 |
1290 |
1291 |
1292 | Called when the WorkItem starts
1293 |
1294 |
1295 |
1296 |
1297 | Called when the WorkItem completes
1298 |
1299 |
1300 |
1301 |
1302 | Returns true when the work item has completed or canceled
1303 |
1304 |
1305 |
1306 |
1307 | Returns true when the work item has canceled
1308 |
1309 |
1310 |
1311 |
1312 | Returns the priority of the work item
1313 |
1314 |
1315 |
1316 |
1317 | A back reference to the work item
1318 |
1319 |
1320 |
1321 |
1322 | Return the result, same as GetResult()
1323 |
1324 |
1325 |
1326 |
1327 | Returns the exception if occured otherwise returns null.
1328 | This value is valid only after the work item completed,
1329 | before that it is always null.
1330 |
1331 |
1332 |
1333 |
1334 | Indicates the state of the work item in the thread pool
1335 |
1336 |
1337 |
1338 |
1339 | Summary description for WorkItemInfo.
1340 |
1341 |
1342 |
1343 |
1344 | Get/Set if to use the caller's security context
1345 |
1346 |
1347 |
1348 |
1349 | Get/Set if to use the caller's HTTP context
1350 |
1351 |
1352 |
1353 |
1354 | Get/Set if to dispose of the state object of a work item
1355 |
1356 |
1357 |
1358 |
1359 | Get/Set the run the post execute options
1360 |
1361 |
1362 |
1363 |
1364 | Get/Set the post execute callback
1365 |
1366 |
1367 |
1368 |
1369 | Get/Set the work item's priority
1370 |
1371 |
1372 |
1373 |
1374 | Get/Set the work item's timout in milliseconds.
1375 | This is a passive timout. When the timout expires the work item won't be actively aborted!
1376 |
1377 |
1378 |
1379 |
1380 | Smart thread pool class.
1381 |
1382 |
1383 |
1384 |
1385 | Default minimum number of threads the thread pool contains. (0)
1386 |
1387 |
1388 |
1389 |
1390 | Default maximum number of threads the thread pool contains. (25)
1391 |
1392 |
1393 |
1394 |
1395 | Default idle timeout in milliseconds. (One minute)
1396 |
1397 |
1398 |
1399 |
1400 | Indicate to copy the security context of the caller and then use it in the call. (false)
1401 |
1402 |
1403 |
1404 |
1405 | Indicate to copy the HTTP context of the caller and then use it in the call. (false)
1406 |
1407 |
1408 |
1409 |
1410 | Indicate to dispose of the state objects if they support the IDispose interface. (false)
1411 |
1412 |
1413 |
1414 |
1415 | The default option to run the post execute (CallToPostExecute.Always)
1416 |
1417 |
1418 |
1419 |
1420 | The default work item priority (WorkItemPriority.Normal)
1421 |
1422 |
1423 |
1424 |
1425 | The default is to work on work items as soon as they arrive
1426 | and not to wait for the start. (false)
1427 |
1428 |
1429 |
1430 |
1431 | The default thread priority (ThreadPriority.Normal)
1432 |
1433 |
1434 |
1435 |
1436 | The default thread pool name. (SmartThreadPool)
1437 |
1438 |
1439 |
1440 |
1441 | The default fill state with params. (false)
1442 | It is relevant only to QueueWorkItem of Action<...>/Func<...>
1443 |
1444 |
1445 |
1446 |
1447 | The default thread backgroundness. (true)
1448 |
1449 |
1450 |
1451 |
1452 | The default apartment state of a thread in the thread pool.
1453 | The default is ApartmentState.Unknown which means the STP will not
1454 | set the apartment of the thread. It will use the .NET default.
1455 |
1456 |
1457 |
1458 |
1459 | The default post execute method to run. (None)
1460 | When null it means not to call it.
1461 |
1462 |
1463 |
1464 |
1465 | The default name to use for the performance counters instance. (null)
1466 |
1467 |
1468 |
1469 |
1470 | The default Max Stack Size. (SmartThreadPool)
1471 |
1472 |
1473 |
1474 |
1475 | Dictionary of all the threads in the thread pool.
1476 |
1477 |
1478 |
1479 |
1480 | Queue of work items.
1481 |
1482 |
1483 |
1484 |
1485 | Count the work items handled.
1486 | Used by the performance counter.
1487 |
1488 |
1489 |
1490 |
1491 | Number of threads that currently work (not idle).
1492 |
1493 |
1494 |
1495 |
1496 | Stores a copy of the original STPStartInfo.
1497 | It is used to change the MinThread and MaxThreads
1498 |
1499 |
1500 |
1501 |
1502 | Total number of work items that are stored in the work items queue
1503 | plus the work items that the threads in the pool are working on.
1504 |
1505 |
1506 |
1507 |
1508 | Signaled when the thread pool is idle, i.e. no thread is busy
1509 | and the work items queue is empty
1510 |
1511 |
1512 |
1513 |
1514 | An event to signal all the threads to quit immediately.
1515 |
1516 |
1517 |
1518 |
1519 | A flag to indicate if the Smart Thread Pool is now suspended.
1520 |
1521 |
1522 |
1523 |
1524 | A flag to indicate the threads to quit.
1525 |
1526 |
1527 |
1528 |
1529 | Counts the threads created in the pool.
1530 | It is used to name the threads.
1531 |
1532 |
1533 |
1534 |
1535 | Indicate that the SmartThreadPool has been disposed
1536 |
1537 |
1538 |
1539 |
1540 | Holds all the WorkItemsGroup instaces that have at least one
1541 | work item int the SmartThreadPool
1542 | This variable is used in case of Shutdown
1543 |
1544 |
1545 |
1546 |
1547 | A common object for all the work items int the STP
1548 | so we can mark them to cancel in O(1)
1549 |
1550 |
1551 |
1552 |
1553 | Windows STP performance counters
1554 |
1555 |
1556 |
1557 |
1558 | Local STP performance counters
1559 |
1560 |
1561 |
1562 |
1563 | Constructor
1564 |
1565 |
1566 |
1567 |
1568 | Constructor
1569 |
1570 | Idle timeout in milliseconds
1571 |
1572 |
1573 |
1574 | Constructor
1575 |
1576 | Idle timeout in milliseconds
1577 | Upper limit of threads in the pool
1578 |
1579 |
1580 |
1581 | Constructor
1582 |
1583 | Idle timeout in milliseconds
1584 | Upper limit of threads in the pool
1585 | Lower limit of threads in the pool
1586 |
1587 |
1588 |
1589 | Constructor
1590 |
1591 | A SmartThreadPool configuration that overrides the default behavior
1592 |
1593 |
1594 |
1595 | Waits on the queue for a work item, shutdown, or timeout.
1596 |
1597 |
1598 | Returns the WaitingCallback or null in case of timeout or shutdown.
1599 |
1600 |
1601 |
1602 |
1603 | Put a new work item in the queue
1604 |
1605 | A work item to queue
1606 |
1607 |
1608 |
1609 | Inform that the current thread is about to quit or quiting.
1610 | The same thread may call this method more than once.
1611 |
1612 |
1613 |
1614 |
1615 | Starts new threads
1616 |
1617 | The number of threads to start
1618 |
1619 |
1620 |
1621 | A worker thread method that processes work items from the work items queue.
1622 |
1623 |
1624 |
1625 |
1626 | Force the SmartThreadPool to shutdown
1627 |
1628 |
1629 |
1630 |
1631 | Force the SmartThreadPool to shutdown with timeout
1632 |
1633 |
1634 |
1635 |
1636 | Empties the queue of work items and abort the threads in the pool.
1637 |
1638 |
1639 |
1640 |
1641 | Wait for all work items to complete
1642 |
1643 | Array of work item result objects
1644 |
1645 | true when every work item in workItemResults has completed; otherwise false.
1646 |
1647 |
1648 |
1649 |
1650 | Wait for all work items to complete
1651 |
1652 | Array of work item result objects
1653 | The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
1654 |
1655 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1656 |
1657 |
1658 | true when every work item in workItemResults has completed; otherwise false.
1659 |
1660 |
1661 |
1662 |
1663 | Wait for all work items to complete
1664 |
1665 | Array of work item result objects
1666 | The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
1667 |
1668 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1669 |
1670 | A cancel wait handle to interrupt the wait if needed
1671 |
1672 | true when every work item in workItemResults has completed; otherwise false.
1673 |
1674 |
1675 |
1676 |
1677 | Wait for all work items to complete
1678 |
1679 | Array of work item result objects
1680 | The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
1681 |
1682 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1683 |
1684 |
1685 | true when every work item in workItemResults has completed; otherwise false.
1686 |
1687 |
1688 |
1689 |
1690 | Wait for all work items to complete
1691 |
1692 | Array of work item result objects
1693 | The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
1694 |
1695 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1696 |
1697 | A cancel wait handle to interrupt the wait if needed
1698 |
1699 | true when every work item in workItemResults has completed; otherwise false.
1700 |
1701 |
1702 |
1703 |
1704 | Waits for any of the work items in the specified array to complete, cancel, or timeout
1705 |
1706 | Array of work item result objects
1707 |
1708 | The array index of the work item result that satisfied the wait, or WaitTimeout if any of the work items has been canceled.
1709 |
1710 |
1711 |
1712 |
1713 | Waits for any of the work items in the specified array to complete, cancel, or timeout
1714 |
1715 | Array of work item result objects
1716 | The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
1717 |
1718 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1719 |
1720 |
1721 | The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
1722 |
1723 |
1724 |
1725 |
1726 | Waits for any of the work items in the specified array to complete, cancel, or timeout
1727 |
1728 | Array of work item result objects
1729 | The number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
1730 |
1731 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1732 |
1733 | A cancel wait handle to interrupt the wait if needed
1734 |
1735 | The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
1736 |
1737 |
1738 |
1739 |
1740 | Waits for any of the work items in the specified array to complete, cancel, or timeout
1741 |
1742 | Array of work item result objects
1743 | The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
1744 |
1745 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1746 |
1747 |
1748 | The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
1749 |
1750 |
1751 |
1752 |
1753 | Waits for any of the work items in the specified array to complete, cancel, or timeout
1754 |
1755 | Array of work item result objects
1756 | The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.
1757 |
1758 | true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
1759 |
1760 | A cancel wait handle to interrupt the wait if needed
1761 |
1762 | The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
1763 |
1764 |
1765 |
1766 |
1767 | Creates a new WorkItemsGroup.
1768 |
1769 | The number of work items that can be run concurrently
1770 | A reference to the WorkItemsGroup
1771 |
1772 |
1773 |
1774 | Creates a new WorkItemsGroup.
1775 |
1776 | The number of work items that can be run concurrently
1777 | A WorkItemsGroup configuration that overrides the default behavior
1778 | A reference to the WorkItemsGroup
1779 |
1780 |
1781 |
1782 | Checks if the work item has been cancelled, and if yes then abort the thread.
1783 | Can be used with Cancel and timeout
1784 |
1785 |
1786 |
1787 |
1788 | Get an array with all the state objects of the currently running items.
1789 | The array represents a snap shot and impact performance.
1790 |
1791 |
1792 |
1793 |
1794 | Start the thread pool if it was started suspended.
1795 | If it is already running, this method is ignored.
1796 |
1797 |
1798 |
1799 |
1800 | Cancel all work items using thread abortion
1801 |
1802 | True to stop work items by raising ThreadAbortException
1803 |
1804 |
1805 |
1806 | Wait for the thread pool to be idle
1807 |
1808 |
1809 |
1810 |
1811 | Executes all actions in parallel.
1812 | Returns when they all finish.
1813 |
1814 | Actions to execute
1815 |
1816 |
1817 |
1818 | Executes all actions in parallel.
1819 | Returns when they all finish.
1820 |
1821 | Actions to execute
1822 |
1823 |
1824 |
1825 | Executes all actions in parallel
1826 | Returns when the first one completes
1827 |
1828 | Actions to execute
1829 |
1830 |
1831 |
1832 | Executes all actions in parallel
1833 | Returns when the first one completes
1834 |
1835 | Actions to execute
1836 |
1837 |
1838 |
1839 | Executes actions in sequence asynchronously.
1840 | Returns immediately.
1841 |
1842 | A state context that passes
1843 | Actions to execute in the order they should run
1844 |
1845 |
1846 |
1847 | Executes actions in sequence asynchronously.
1848 | Returns immediately.
1849 |
1850 |
1851 | Actions to execute in the order they should run
1852 |
1853 |
1854 |
1855 | An event to call after a thread is created, but before
1856 | it's first use.
1857 |
1858 |
1859 |
1860 |
1861 | An event to call when a thread is about to exit, after
1862 | it is no longer belong to the pool.
1863 |
1864 |
1865 |
1866 |
1867 | A reference to the current work item a thread from the thread pool
1868 | is executing.
1869 |
1870 |
1871 |
1872 |
1873 | This event is fired when a thread is created.
1874 | Use it to initialize a thread before the work items use it.
1875 |
1876 |
1877 |
1878 |
1879 | This event is fired when a thread is terminating.
1880 | Use it for cleanup.
1881 |
1882 |
1883 |
1884 |
1885 | Get/Set the lower limit of threads in the pool.
1886 |
1887 |
1888 |
1889 |
1890 | Get/Set the upper limit of threads in the pool.
1891 |
1892 |
1893 |
1894 |
1895 | Get the number of threads in the thread pool.
1896 | Should be between the lower and the upper limits.
1897 |
1898 |
1899 |
1900 |
1901 | Get the number of busy (not idle) threads in the thread pool.
1902 |
1903 |
1904 |
1905 |
1906 | Returns true if the current running work item has been cancelled.
1907 | Must be used within the work item's callback method.
1908 | The work item should sample this value in order to know if it
1909 | needs to quit before its completion.
1910 |
1911 |
1912 |
1913 |
1914 | Thread Pool start information (readonly)
1915 |
1916 |
1917 |
1918 |
1919 | Return the local calculated performance counters
1920 | Available only if STPStartInfo.EnableLocalPerformanceCounters is true.
1921 |
1922 |
1923 |
1924 |
1925 | Get/Set the maximum number of work items that execute cocurrency on the thread pool
1926 |
1927 |
1928 |
1929 |
1930 | Get the number of work items in the queue.
1931 |
1932 |
1933 |
1934 |
1935 | WorkItemsGroup start information (readonly)
1936 |
1937 |
1938 |
1939 |
1940 | This event is fired when all work items are completed.
1941 | (When IsIdle changes to true)
1942 | This event only work on WorkItemsGroup. On SmartThreadPool
1943 | it throws the NotImplementedException.
1944 |
1945 |
1946 |
1947 |
1948 | The thread creation time
1949 | The value is stored as UTC value.
1950 |
1951 |
1952 |
1953 |
1954 | The last time this thread has been running
1955 | It is updated by IAmAlive() method
1956 | The value is stored as UTC value.
1957 |
1958 |
1959 |
1960 |
1961 | A reference from each thread in the thread pool to its SmartThreadPool
1962 | object container.
1963 | With this variable a thread can know whatever it belongs to a
1964 | SmartThreadPool.
1965 |
1966 |
1967 |
1968 |
1969 | A reference to the current work item a thread from the thread pool
1970 | is executing.
1971 |
1972 |
1973 |
1974 |
1975 | An internal delegate to call when the WorkItem starts or completes
1976 |
1977 |
1978 |
1979 |
1980 | Represents an exception in case IWorkItemResult.GetResult has been canceled
1981 |
1982 |
1983 | Represents an exception in case IWorkItemResult.GetResult has been canceled
1984 |
1985 |
1986 |
1987 |
1988 | Represents an exception in case IWorkItemResult.GetResult has been timed out
1989 |
1990 |
1991 | Represents an exception in case IWorkItemResult.GetResult has been timed out
1992 |
1993 |
1994 |
1995 |
1996 | Represents an exception in case IWorkItemResult.GetResult has been timed out
1997 |
1998 |
1999 | Represents an exception in case IWorkItemResult.GetResult has been timed out
2000 |
2001 |
2002 |
2003 |
2004 | EventWaitHandleFactory class.
2005 | This is a static class that creates AutoResetEvent and ManualResetEvent objects.
2006 | In WindowCE the WaitForMultipleObjects API fails to use the Handle property
2007 | of XxxResetEvent. It can use only handles that were created by the CreateEvent API.
2008 | Consequently this class creates the needed XxxResetEvent and replaces the handle if
2009 | it's a WindowsCE OS.
2010 |
2011 |
2012 |
2013 |
2014 | Create a new AutoResetEvent object
2015 |
2016 | Return a new AutoResetEvent object
2017 |
2018 |
2019 |
2020 | Create a new ManualResetEvent object
2021 |
2022 | Return a new ManualResetEvent object
2023 |
2024 |
2025 |
2026 | Create a new work item
2027 |
2028 | The WorkItemsGroup of this workitem
2029 | Work item group start information
2030 | A callback to execute
2031 | Returns a work item
2032 |
2033 |
2034 |
2035 | Create a new work item
2036 |
2037 | The WorkItemsGroup of this workitem
2038 | Work item group start information
2039 | A callback to execute
2040 | The priority of the work item
2041 | Returns a work item
2042 |
2043 |
2044 |
2045 | Create a new work item
2046 |
2047 | The WorkItemsGroup of this workitem
2048 | Work item group start information
2049 | Work item info
2050 | A callback to execute
2051 | Returns a work item
2052 |
2053 |
2054 |
2055 | Create a new work item
2056 |
2057 | The WorkItemsGroup of this workitem
2058 | Work item group start information
2059 | A callback to execute
2060 |
2061 | The context object of the work item. Used for passing arguments to the work item.
2062 |
2063 | Returns a work item
2064 |
2065 |
2066 |
2067 | Create a new work item
2068 |
2069 | The work items group
2070 | Work item group start information
2071 | A callback to execute
2072 |
2073 | The context object of the work item. Used for passing arguments to the work item.
2074 |
2075 | The work item priority
2076 | Returns a work item
2077 |
2078 |
2079 |
2080 | Create a new work item
2081 |
2082 | The work items group
2083 | Work item group start information
2084 | Work item information
2085 | A callback to execute
2086 |
2087 | The context object of the work item. Used for passing arguments to the work item.
2088 |
2089 | Returns a work item
2090 |
2091 |
2092 |
2093 | Create a new work item
2094 |
2095 | The work items group
2096 | Work item group start information
2097 | A callback to execute
2098 |
2099 | The context object of the work item. Used for passing arguments to the work item.
2100 |
2101 |
2102 | A delegate to call after the callback completion
2103 |
2104 | Returns a work item
2105 |
2106 |
2107 |
2108 | Create a new work item
2109 |
2110 | The work items group
2111 | Work item group start information
2112 | A callback to execute
2113 |
2114 | The context object of the work item. Used for passing arguments to the work item.
2115 |
2116 |
2117 | A delegate to call after the callback completion
2118 |
2119 | The work item priority
2120 | Returns a work item
2121 |
2122 |
2123 |
2124 | Create a new work item
2125 |
2126 | The work items group
2127 | Work item group start information
2128 | A callback to execute
2129 |
2130 | The context object of the work item. Used for passing arguments to the work item.
2131 |
2132 |
2133 | A delegate to call after the callback completion
2134 |
2135 | Indicates on which cases to call to the post execute callback
2136 | Returns a work item
2137 |
2138 |
2139 |
2140 | Create a new work item
2141 |
2142 | The work items group
2143 | Work item group start information
2144 | A callback to execute
2145 |
2146 | The context object of the work item. Used for passing arguments to the work item.
2147 |
2148 |
2149 | A delegate to call after the callback completion
2150 |
2151 | Indicates on which cases to call to the post execute callback
2152 | The work item priority
2153 | Returns a work item
2154 |
2155 |
2156 |
2157 | This class stores the caller call context in order to restore
2158 | it when the work item is executed in the thread pool environment.
2159 |
2160 |
2161 |
2162 |
2163 | Constructor
2164 |
2165 |
2166 |
2167 |
2168 | Captures the current thread context
2169 |
2170 |
2171 |
2172 |
2173 |
2174 | Applies the thread context stored earlier
2175 |
2176 |
2177 |
2178 |
2179 |
2180 |
--------------------------------------------------------------------------------
/IPScannerLib/SmartThreadPool.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bp2008/IPScanner/8740b25f491aba6707b2e3983e7264c2a7e4c195/IPScannerLib/SmartThreadPool.dll
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 bp2008
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # IPScanner
2 | IP address scanner written in C#
3 |
4 | I wrote this IP address scanner myself. It is not efficient or well-polished, but it scans a network quicker than just about anything. I have customized it to recognize most devices on the networks I manage.
5 |
--------------------------------------------------------------------------------