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& ......
C# ÓïÑÔÖеÄÓÐЩ¹¹ÔìÒªÇóij¸öÀàÐÍÖÁÉÙÓëij¸ö³ÉÔ±»òÆäËûÀàÐ;ßÓÐͬÑùµÄ¿É·ÃÎÊÐÔ (at least as accessible as)¡£Èç¹û T µÄ¿É·ÃÎÊÓòÊÇ M ¿É·ÃÎÊÓòµÄ³¬¼¯£¬ÎÒÃǾÍ˵ÀàÐÍ T ÖÁÉÙÓë³ÉÔ±»òÀàÐÍ M ¾ßÓÐͬÑùµÄ¿É·ÃÎÊÐÔ¡£»»ÑÔÖ®£¬Èç¹û T ÔÚ¿É·ÃÎÊ M µÄËùÓÐÉÏÏÂÎÄÖж¼ÊǿɷÃÎʵģ¬Ôò T ÖÁÉÙÓë M ¾ßÓÐͬÑùµÄ¿É·ÃÎÊÐÔ¡£
´æÔÚÏÂÁпɷÃÎÊÐ ......
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.¾²Ì¬³ÉÔ±ºÍ·Ç¾²Ì¬³ÉÔ±µÄÇø±ð£¿
2.const ºÍ static readonly Çø±ð£¿
3.extern ÊÇʲôÒâ˼£¿
4.abstract ÊÇʲôÒâ˼£¿
5.internal ÐÞÊηûÆðʲô×÷Óã¿
6.sealed ÐÞÊηûÊǸÉʲôµÄ£¿
7.override ºÍ overload µÄÇø±ð£¿
8.ʲôÊÇË÷ÒýָʾÆ÷£¿
9.new ÐÞÊηûÊÇÆðʲô×÷Óã¿
10.this ¹Ø¼ü×ֵĺ¬Ò壿
11.¿ÉÒÔʹÓóéÏóº¯Ê ......
±äÁ¿¡¢³£Á¿¼°±í´ïʽ±äÁ¿ºÍ³£Á¿±äÁ¿(¾²Ì¬¡¢·Ç¾²Ì¬¡¢Êý×éÔªËØ¡¢Öµ²ÎÊý¡¢ÒýÓòÎÊý¡¢Êä³ö²ÎÊý¡¢¾Ö²¿±äÁ¿)¾²Ì¬(static) Èç public static int x; Ò»µ©¾²Ì¬±äÁ¿ËùÊôµÄÀà±»×°ÔØ£¬Ö±µ½°üº¬¸ÃÀàµÄ³ÌÐòÔËÐнáÊøÊ±ËüÒ»Ö±´æÔÚ¡£·Ç¾²Ì¬£º²»´øÓÐstaticÐÞÊηûÉùÃ÷µÄ±äÁ¿³ÆÎªÊµÀý±äÁ¿£¬Èçint a ;³£Á¿(attributes constnt-modifiers CO ......