02 2012 档案

【转】C#写的170行俄罗斯方块
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespace俄罗斯方方块{publicpartialclassForm1:Form{publicForm1(){this.Load+=newSystem.EventHandler(load);InitializeComponent();}Point[,]ai 阅读全文

posted @ 2012-02-20 12:49 LT 阅读(543) 评论(0) 推荐(0) 编辑

[转]C#获取窗口进程ID与句柄还有读写内存类
摘要:using System; using System.Text; using System.Diagnostics; using System.Runtime.InteropServices; namespace PlantsVsZombiesTool { public abstract class Helper { [DllImportAttribute("kernel32.dll", EntryPoint = "ReadProcessMemory")] public static extern bool ReadProcessMemory ( Int 阅读全文

posted @ 2012-02-20 12:44 LT 阅读(1635) 评论(0) 推荐(0) 编辑

一个好用的C#抓图类
摘要:The Utilities class. Call Utilities.CaptureWindow(Control.Handle) to capture a specific control: public static class Utilities{ public static Image CaptureScreen() { return CaptureWindow(User32.GetDesktopWindow()); } public static Image CaptureWindow(IntPtr handle) { IntPtr hdcSrc = User... 阅读全文

posted @ 2012-02-09 18:23 LT 阅读(664) 评论(0) 推荐(0) 编辑

【转】WinSocket编程——原始套接字
摘要:http://blog.csdn.net/dylgsy/article/details/1957138 阅读全文

posted @ 2012-02-05 22:17 LT 阅读(565) 评论(0) 推荐(0) 编辑

【转】SHarpPcap(winpcap基于c#封转的库)网络嗅探程序核心
摘要:1. 获得网络设备 由于一个系统的网络设备可能不止一个,因而使用了一个列表类来保存所有的设备,这里使用了一个静态方法进行操作 /* Retrieve the device list */ PcapDeviceList devices = SharpPcap.GetAllDevices(); 获取列表后,就能对设备进行操作了,其实设备分为2个子类,一类是NetworkDevice,这个是算是真实的网络设备吧,还有一类是PcapOfflineDevice,这个类是通过读取抓包文件生成的虚拟设备. 如果是NetworkDevice,那么还有些其他的网络信息,如ip地址,子网掩码等. 2.... 阅读全文

posted @ 2012-02-05 22:16 LT 阅读(4142) 评论(0) 推荐(0) 编辑

[心得] socket 多路复用误区
摘要:最近设计了个UDP服务器,开始只使用一个socket进行收发,结果数据一多,一个socket异步收发(基于IO完成端口)出现N多问题。 所以只能分开两个socket搞了,找了下文章。首先udp和tcp不一样,tcp同一个端口只能一个listen,UDP则可以同时监听(当然只能其中一个获得数据,按规则匹配) 1、UDP多路复用的是按最小规范集转发数据的。例如A bing any , b bing 127.0.01,这时如果收到一个地址为127.0.0.1的包,那么b的绑定记录显然更详细,B得到了数据,A收不到。如果非127.0.01的本机地址按AB的绑定分析后则是a获得数据。 2、如果A\B都绑 阅读全文

posted @ 2012-02-03 18:52 LT 阅读(405) 评论(0) 推荐(0) 编辑

UDP 异步 收发 服务端例子 【转载】
摘要:采用异步模式设计的UDP服务器,源码如下: 1 using System; 2 using System.Net; 3 using System.Net.Sockets; 4 using System.ServiceProcess; 5 using System.Threading; 6 7 namespace TestUdpServer 8 { 9 // this class encapsulates a single packet that 10 // is either sent or received by a UDP socket 11 public ... 阅读全文

posted @ 2012-02-02 00:14 LT 阅读(490) 评论(0) 推荐(0) 编辑

UDPClient 的奇特现象,实在搞不懂
摘要:我有个项目,设计了一个UDP服务端。是通过UDPCLIENT 的一个实例(同一端口)提供收发服务。当项目上线测试后,奇怪的现象发生。如果重启过服务器的话,服务器可以运行一段较长时间无异常。但一段时间之后,奇怪的事情来了。1、例如之前有A\B\C等N个客户端已经连接到服务端,服务端一直持续为它们 提供服务,然后在正常运行一段时间后,ABC的数据都会变得不正常,服务端无法再正常解析数据提供服务了。客户数据是可以接收到,但已经不正确了。2、然后更搞笑的是,如果有新入的连接(不同的IP),服务端却又能正常提供为该客户服务,但服务一段时间后,就会表现和ABC一样。然后重复上面的两个问题 ,不断累积,反. 阅读全文

posted @ 2012-02-01 20:33 LT 阅读(1042) 评论(2) 推荐(0) 编辑

导航

直角体Web动力
点击右上角即可分享
微信分享提示