看完ping的小秘密后有感,呵呵 !现在再把它详细的发出来分享下,也是在网上学习的,呵呵!
如何看懂ping命令
Ping是用来进行网络连接测试的一个程序,其对应的文件名为“Ping.exe”(在Windows XP系统下该文件存在于
C:\Windows\System32文件夹下)。该工具的最简单的用法是: “Ping XXX.XXX.XXX.XXX”(XXX.XXX.XXX.XXX为欲测试的IP地址),根据不同的测试目的可以带上不同的参数。
很多朋友未必熟悉其运行结果的意义,下面简要介绍一下成功结果和失
如何看懂ping命令
Ping是用来进行网络连接测试的一个程序,其对应的文件名为“Ping.exe”(在Windows XP系统下该文件存在于
C:\Windows\System32文件夹下)。该工具的最简单的用法是: “Ping XXX.XXX.XXX.XXX”(XXX.XXX.XXX.XXX为欲测试的IP地址),根据不同的测试目的可以带上不同的参数。
很多朋友未必熟悉其运行结果的意义,下面简要介绍一下成功结果和失
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.CreateCheckCodeImage(GenerateCheckCode());
}
//产生随机数的函数
private string GenerateCheckCode()
{
int number;
char code;
//空字符串且为只读属性
string checkCode = String.Empty;
//新建一个随机数产生器
System.Random random = new Random();
for (int i = 0; i < 5; i++)
{ //随机产生一个整数
number = random.Next();
//如果随机数是偶数 取余
if (number % 2 == 0)
code = (char)('0' + (char)(number % 10));
else
//如果随机数是奇数 选择从[A-Z]
code = (char)('A' + (char)(number % 26));
//5个字符的组合
checkCode += code.ToString();
}
//将字符串checkCode写入Cookies并且返回字符串checkCode
Response.Cookies.Add(new HttpCookie("CheckCode", checkCode));
return checkCode;
}
//建立一个随机图形
private void CreateCheckCodeImage(string checkCode)
{
if (checkCode == null || checkCode.Trim() == String.Empty)
return;
//建立一个位图文件 确立长宽
System.Drawing.Bitmap image = new System.Drawing.Bitmap((int)Math.Ceiling((checkCode.Length * 12.5)), 22);
Graphics g = Graphics.FromImage(image);
try
{
//生成随机生成器
Random random = new Random();
//清空图片背景色
g.Clear(Color.White);
//画图片的背景噪音线
for (int i = 0; i < 25; i++)
{
int x1 = random.Next(image.Width);
int x2 = random.Next(image.Width);
int y1 = random.Next(image.Height);
int y2 = random.Next(image.Height);
g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
}
//把产生的随机数以字体的形式写入画面
Font font = new System.Drawing.Font("Arial", 12, (System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic));
System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), Color.Blue, Color.DarkRed, 1.2f, true);
g.DrawString(checkCode, font, brush, 2, 2);
//画图片的前景噪音点
for (int i = 0; i < 100; i++)
{
int x = random.Next(image.Width);
int y = random.Next(image.Height);
image.SetPixel(x, y, Color.FromArgb(random.Next()));
}
//画图片的边框线
g.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width - 1, image.Height - 1);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
Response.ClearContent();
Response.ContentType = "image/Gif";
Response.BinaryWrite(ms.ToArray());
}
finally
{
g.Dispose();
image.Dispose();
}
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.CreateCheckCodeImage(GenerateCheckCode());
}
//产生随机数的函数
private string GenerateCheckCode()
{
int number;
char code;
//空字符串且为只读属性
string checkCode = String.Empty;
//新建一个随机数产生器
System.Random random = new Random();
for (int i = 0; i < 5; i++)
{ //随机产生一个整数
number = random.Next();
//如果随机数是偶数 取余
if (number % 2 == 0)
code = (char)('0' + (char)(number % 10));
else
//如果随机数是奇数 选择从[A-Z]
code = (char)('A' + (char)(number % 26));
//5个字符的组合
checkCode += code.ToString();
}
//将字符串checkCode写入Cookies并且返回字符串checkCode
Response.Cookies.Add(new HttpCookie("CheckCode", checkCode));
return checkCode;
}
//建立一个随机图形
private void CreateCheckCodeImage(string checkCode)
{
if (checkCode == null || checkCode.Trim() == String.Empty)
return;
//建立一个位图文件 确立长宽
System.Drawing.Bitmap image = new System.Drawing.Bitmap((int)Math.Ceiling((checkCode.Length * 12.5)), 22);
Graphics g = Graphics.FromImage(image);
try
{
//生成随机生成器
Random random = new Random();
//清空图片背景色
g.Clear(Color.White);
//画图片的背景噪音线
for (int i = 0; i < 25; i++)
{
int x1 = random.Next(image.Width);
int x2 = random.Next(image.Width);
int y1 = random.Next(image.Height);
int y2 = random.Next(image.Height);
g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
}
//把产生的随机数以字体的形式写入画面
Font font = new System.Drawing.Font("Arial", 12, (System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic));
System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0, 0, image.Width, image.Height), Color.Blue, Color.DarkRed, 1.2f, true);
g.DrawString(checkCode, font, brush, 2, 2);
//画图片的前景噪音点
for (int i = 0; i < 100; i++)
{
int x = random.Next(image.Width);
int y = random.Next(image.Height);
image.SetPixel(x, y, Color.FromArgb(random.Next()));
}
//画图片的边框线
g.DrawRectangle(new Pen(Color.Silver), 0, 0, image.Width - 1, image.Height - 1);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
Response.ClearContent();
Response.ContentType = "image/Gif";
Response.BinaryWrite(ms.ToArray());
}
finally
{
g.Dispose();
image.Dispose();
}
}
}
//假设要生成的JS文件为:xyz.js
string path = Server.MapPath("../js/xyz.js ");
// Delete the file if it exists.
if (File.Exists(path))
{
File.Delete(path);
}
// Create the file.
StreamWriter sr = File.CreateText(path);
sr.WriteLine ("functio
string path = Server.MapPath("../js/xyz.js ");
// Delete the file if it exists.
if (File.Exists(path))
{
File.Delete(path);
}
// Create the file.
StreamWriter sr = File.CreateText(path);
sr.WriteLine ("functio
GetSartupInfo 获取一个进程的启动信息
GetThreadPriority 获取特定线程的优先级别
GetTheardTimes 获取与一个线程的经过时间有关的信息
GetWindowThreadProcessId 获取与指定窗口关联在一起的一个进程和线程标识符
LoadLibrary 载入指定的动态链接库,并将它映射到当前进程使用的地址空间
LoadLibraryEx 装载指定的动态链接库,并为当前进程把它映射到地址空间
LoadModule 载入一个Windows应用程序,并在指定的环境中运行
MsgWait
GetThreadPriority 获取特定线程的优先级别
GetTheardTimes 获取与一个线程的经过时间有关的信息
GetWindowThreadProcessId 获取与指定窗口关联在一起的一个进程和线程标识符
LoadLibrary 载入指定的动态链接库,并将它映射到当前进程使用的地址空间
LoadLibraryEx 装载指定的动态链接库,并为当前进程把它映射到地址空间
LoadModule 载入一个Windows应用程序,并在指定的环境中运行
MsgWait
GetVersionEx 取得与平台和操作系统有关的版本信息
HideCaret 在指定的窗口隐藏插入符(光标)
IsValidCodePage 判断一个代码页是否有效
IsValidLocale 判断地方标识符是否有效
keybd_event 这个函数模拟了键盘行动
LoadKeyboardLayout 载入一个键盘布局
MapVirtualKey 根据指定的映射类型,执行不同的扫描码和字符转换
MapVirtualKeyEx 根据指定的映射类型,执行不同的扫描码和字符转换
MessageBeep 播放一个系统声
HideCaret 在指定的窗口隐藏插入符(光标)
IsValidCodePage 判断一个代码页是否有效
IsValidLocale 判断地方标识符是否有效
keybd_event 这个函数模拟了键盘行动
LoadKeyboardLayout 载入一个键盘布局
MapVirtualKey 根据指定的映射类型,执行不同的扫描码和字符转换
MapVirtualKeyEx 根据指定的映射类型,执行不同的扫描码和字符转换
MessageBeep 播放一个系统声






