參考資料:
上過MSDN的開發者都知道 vb vc c# vj的樣例是統壹的 僅僅是語法表達不壹樣罷了!也就是說用VC寫的功能 同樣也能用VB寫出來!
下面提供壹段VB利用API截獲RAW SOCKET封包的代碼,請不吝賜教!
Dim soc As Long, dwRc As Long
Dim RemoteAddr As sockaddr
Dim LocalAddr As sockaddr
Dim inBuffer, outBuffer As String
Dim byteReturn As Long
Dim RetMsg As String
Dim strData As String
Dim nReceived As Long
Const MAX_PACK_LEN = 4096
Dim keepRun As Boolean
Dim asc() As Byte
Private Type TcpHeader 'typedef struct tcp_hdr //定義TCP首部
th_sport As Integer '; //16位源端口
th_dport As Integer '; //16位目的端口
th_seq As Long '; //32位序列號
th_ack As Long '; //32位確認號
th_lenres As Byte '; //4位首部長度/6位保留字
th_flag As Byte '; //6位標誌位
th_win As Integer '; //16位窗口大小
th_sum As Integer '; //16位校驗和
th_urp As Integer '; //16位緊急數據偏移量
End Type
........ 資料地址: /zyq0ting/blog/item/ab10783eca88783b70cf6ceb.html