C#ɨÃè¼ÆËã»ú¶Ë¿Ú
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace PortScanner
{
class Program
{
¡¡//ÒÑɨÃè¶Ë¿ÚÊýÄ¿
¡¡internal static int scannedCount = 0;
¡¡//ÕýÔÚÔËÐеÄÏß³ÌÊýÄ¿
¡¡internal static int runningThreadCount = 0;
¡¡//´ò¿ªµÄ¶Ë¿ÚÊýÄ¿
¡¡internal static List<int> openedPorts = new List<int>();
¡¡//ÆðʼɨÃè¶Ë¿Ú
¡¡static int startPort = 1;
¡¡//½áÊø¶Ë¿ÚºÅ
¡¡static int endPort = 500;
¡¡//×î´ó¹¤×÷Ïß³ÌÊý
¡¡static int maxThread = 10;
¡¡static void Main(string[] args)
¡¡{
¡¡¡¡//½ÓÊÕ´«Èë²ÎÊýÒ»×÷ΪҪɨÃèµÄÖ÷»ú
¡¡¡¡string host = "192.168.0.1";
¡¡¡¡//½ÓÊÕ´«Èë²ÎÊý¶þ×÷Ϊ¶Ë¿ÚɨÃ跶Χ£¬Èç1-4000
¡¡¡¡string portRange = "1-400";
¡¡¡¡startPort = int.Parse(portRange.Split('-')[0].Trim());
¡¡¡¡endPort = int.Parse(portRange.Split('-')[1].Trim());
¡¡¡¡for (int port = startPort; port < endPort; port++)
¡¡¡¡{
¡¡¡¡¡¡//´´½¨É¨ÃèÀà
¡¡¡¡¡¡Scanner scanner = new Scanner(host, port);
¡¡¡¡¡¡Thread thread = new Thread(new ThreadStart(scanner.Scan));
¡¡¡¡¡¡thread.Name = port.ToString();
¡¡¡¡¡¡ thread.IsBackground = true;
¡¡¡¡¡¡//Æô¶¯É¨ÃèÏß³Ì
¡¡¡¡¡¡thread.Start();
¡¡¡¡¡¡runningThreadCount++;
¡¡¡¡¡¡Thread.Sleep(10);
¡¡¡¡¡¡//Ñ»·£¬Ö±µ½Ä³¸öÏ̹߳¤×÷Íê±Ï²ÅÆô¶¯ÁíÒ»ÐÂỊ̈߳¬Ò²¿ÉÒÔ½Ð×öÍÆÀ´°¼¼Êõ
¡¡¡¡¡¡while (runningThreadCount >= maxThread) ;
¡¡¡¡}
¡¡¡¡//¿ÕÑ»·£¬Ö±µ½ËùÓж˿ÚɨÃèÍê±Ï
¡¡¡¡while (scannedCount + 1 < (endPort - startPort)) ;
¡¡¡¡¡¡Console.WriteLine();
¡¡¡¡¡¡Console.WriteLine();
¡¡¡¡¡¡//Êä³ö½á¹û
¡¡¡¡¡¡Console.WriteLine("Scan for host: {0} has been completed , \n total {1} ports scanned, \nopened ports :{2}",
host, (endPort - startPort), openedPorts.Count);
¡¡¡¡foreach (int port in openedPorts)
¡¡¡¡¡¡Console.WriteLine("\tPort: {0} is open", port.ToString().PadLeft(6));
¡¡}
}
//ɨÃèÀà
class Scanner
{
¡¡string m_host;
¡¡int m_port;
¡¡
¡¡public Scanner(string host, int port)
¡¡{
¡¡¡¡m_h
Ïà¹ØÎĵµ£º
/// <summary>
/// Ö§³ÖXMLÐòÁл¯µÄ·ºÐÍ Dictionary
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
[XmlRoot("SerializableDictionary")]
public class SerializableDictionary<TKey, TValue& ......
RT¡£ÏÈÌù´úÂë
C# code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Value_Ref_test1
{
class Program
{
static void Main(string[] args)
{
point a = new point (10,10) ;
point b = a;
......
1. ÃüÃû¹æ·¶
a) Àà
¡¾¹æÔò1-1¡¿Ê¹ÓÃPascal¹æÔòÃüÃûÀàÃû£¬¼´Ê××ÖĸҪ´óд¡£
¡¾¹æÔò1-2¡¿Ê¹ÓÃÄܹ»·´Ó³À๦ÄܵÄÃû´Ê»òÃû´Ê¶ÌÓïÃüÃûÀà¡£
¡¾¹æÔò1-3¡¿²»ÒªÊ¹ÓÓI”¡¢“C”¡¢“_”µÈÌØ¶¨º¬Òåǰ׺¡£
¡¾¹æÔò1-4¡¿×Ô¶¨ÒåÒì³£ÀàÓ¦ÒÔException½áβ¡£
¡¾¹æÔò1-5¡¿ÎļþÃûÒªÄÜ·´Ó ......
¡¡¡¡Bin Ŀ¼ÓÃÀ´´æ·Å±àÒëµÄ½á¹û£¬binÊǶþ½øÖÆbinraryµÄÓ¢ÎÄËõд£¬ÒòΪ×î³õC±àÒëµÄ³ÌÐòÎļþ¶¼ÊǶþ½øÖÆÎļþ£¬ËüÓÐDebugºÍReleaseÁ½¸ö°æ±¾£¬·Ö±ð¶ÔÓ¦µÄÎļþ¼ÐΪbin/DebugºÍbin/Release£¬Õâ¸öÎļþ¼ÐÊÇĬÈϵÄÊä³ö·¾¶£¬ÎÒÃÇ¿ÉÒÔͨ¹ý£ºÏîÄ¿ÊôÐÔ—>ÅäÖÃÊôÐÔ—>Êä³ö·¾¶À´Ð޸ġ£
¡¡¡¡objÊÇobjectµÄËõд£¬ÓÃÓÚ´æ·Å ......
ͨ¹ý·´É䣬µÃµ½Õë¶Ôijһö¾ÙÀàÐ͵ÄÃèÊö¡£
ö¾ÙµÄ¶¨ÒåÖмÓÈëÃèÊö
using System;
using System.Collections;
namespace Ahnlab.ApplicationServices
{
public sealed partial class SysEnums
{
#region ϵͳ¹ÜÀíÄ£¿éµÄö¾ÙÐÅÏ¢
/// <summary>
/// ÔÚÏß²»Á¼Åâ³ ......