端口扫描的三种方式_vb端口扫描高效

hacker|
151

VB6.0 扫描端口

计算机 *** 技术的日益发展和普及,为信息共享提供了一条全球性的高速通道,但目前采用的TCP/IP协议族潜在着安全漏洞,其安全机制并不健全,如何保护企业内部 *** 中的资源及信息不受外部攻击者肆意破坏或盗窃,是企业 *** 安全需要解决的重要问题。当我们担心被黑客攻击或怀疑电脑被植入木马时,我们往往求助于防火墙,本系统即通过实时监控全部TCP连接的 *** 来实现防黑客攻击。同时 *** 管理人员在整个 *** 运行期间,能否实时监控联网计算机的运行状态和操作对 *** 安全具有极其重要的作用.下面就以Visual Basic 6.0作为开发工具讲述两个主要模块的设计和实现。

系统概述

该系统由两个子系统组成:服务器端系统和客户端(工作站)系统。服务器端系统安装在 *** 管理人员的计算机上,用于实施各种对联网计算机的监控操作;客户端系统安装在每台联网的计算机上,它运行后以图标的方式出现在系统任务栏的提示区中,不影响工作站的其他操作,只用于响应服务器端的监控命令,并根据服务的需要,及时采样工作站的相应数据返回给服务器端。该系统的运行环境可以运行于Win98、Win95或WinNT、Win2000下。在系统的开发中,引入了WINSOCK通讯控件,除此之外,为较好地实现各项监控操作,还用到了几个API函数。

系统功能

1、监控全部TCP连接:实时监控所有服务器端口的连接情况、及时对异常连接发出警告并提示用户删除异常连接;

2、屏幕监控:该功能允许服务器随时把被监控工作站的屏幕画面抓取到服务器中, *** 管理人员对相应工作站所进行的操作一目了然,若发现有非法操作即可采取发送警告或强制措施,强迫其停止相应操作;

3、对工作站进行锁机、关机、限制鼠标活动等;

4、服务器和工作站之间的信息互送。

功能的实现

1、监控全部TCP连接

TCP/IP(Tran *** ission Control Protocol/Internet Protocol:传输控制协议/互联网协议)是一个包括TCP、IP、 UDP、ARP、RARP和ICMP等在内的 *** 协议集。TCP/IP经常被称为“将Internet绑定在一起的粘合剂”,它允许在空间上分离的多个信息 *** 连接在一起形成一个巨大的虚拟 *** 。TCP和UDP(用户数据报协议)是两个最常用的数据传输协议,它们都使用设置监听端口的 *** 来完成数据传输。

在本文中讨论TCP连接。通过使用TCP, Internet客户机可以打开到另一个Internet客户机的虚拟连接并传送数据流。与UDP不同,TCP协议通过重传丢失的数据报保证传输的可靠性。它也保证在接收端的应用程序按发送的顺序将接收到的位和字节重新组装起来以获取完整的数据。

要获得与服务器系统中全部有效的TCP连接,用到GetTcpTable这个API函数,它定义如下:

Private Declare Function GetTcpTable Lib "iphlpapi.

dll" (ByRef pTcpTable As MIB_TCPTABLE, ByRef

pdwSize As Long, ByVal bOrder As Long) As Long

其中参数pPcpTable是已生成的 TCP连接表缓冲区的指针,参数pdwsize是缓冲区大小(当缓冲区不够大时,该参数返回实际需要的大小),参数bOrder指示连接表是否需要按“Local IP”、“Localport”、“Remote IP”、“Remote port”依次进行排序,1为按此顺序。

通过一个TIMEER控件的TIMER的事件来比较前后两个TCP连接表,我们可以立即发现异常并发出警告。本系统用声音和报警标志提醒用户注意可能的外界入侵。收到警告信号后,我们应首先将可疑连接删除掉,SetTcpEntry函数可以帮助我们删除可疑连接。其定义为:

Private Declare Function SetTcpEntry Lib "iphlpapi.

dll" (ByRef pTcpTable As MIB_TCPROW) As Long

其中参数pTcptable为指向tcp表行的指针。然后将欲删连接的状态置为MIB_TCP_STATE_DELETE_TCB(值为12)即可删除该连接。

TIMER事件源代码:

Private Sub Timer1_Timer()

Dim Return1 As Long, i As Long

Dim Tmp1 As Long, Tmp2 As Long

Dim Ip_Buf(1 To 4) As Byte

Dim Win_Path As String, Tmp3 As String

Return1 = GetTcpTable(TCP1, Len(TCP1), 1)

If Last_Num_Of_Entries 0 And _

Last_Num_Of_Entries TCP1.dwNum_Of_Entries Then

'异常时发出警告

Picture1.Visible = True '警告标志

On Error Resume Next

Win_Path = String(145, 0)

'利用API函数GetWindowsDirectory获得当前系统目录

i = GetWindowsDirectory(Win_Path, 145)

Win_Path = Left(Win_Path, i)

'利用API函数sndPlaySound发出报警声音

i = sndPlaySound(Win_Path + "\Media\Ding.wav", H1)

On Error GoTo 0

Else

If Picture1.Visible = True Then

Picture1.Visible = False

End If

End If

Last_Num_Of_Entries = TCP1.dwNum_Of_Entries

Select Case Return1

Case 0:

Text1 = "": Combo1.Clear

For i = 0 To TCP1.dwNum_Of_Entries - 1

Tmp3 = Str(i + 1) + " "

Select Case TCP1.TCP_Table(i).dwState

' 显示连接状态

Case 1: Tmp3 = Tmp3 + "CLOSED"

Case 2: Tmp3 = Tmp3 + "LISTENING"

Case 3: Tmp3 = Tmp3 + "SYN_SENT"

Case 4: Tmp3 = Tmp3 + "SYN_RCVD"

Case 5: Tmp3 = Tmp3 + "ESTABLISHED"

Case 6: Tmp3 = Tmp3 + "FIN_WAIT1"

Case 7: Tmp3 = Tmp3 + "FIN_WAIT2"

Case 8: Tmp3 = Tmp3 + "CLOSE_WAIT"

Case 9: Tmp3 = Tmp3 + "CLOSING"

Case 10: Tmp3 = Tmp3 + "LAST_ACK"

Case 11: Tmp3 = Tmp3 + "TIME_WAIT"

Case 12: Tmp3 = Tmp3 + "DELETE_TCB"

End Select

Combo1.AddItem Tmp3 ' 填充列表以供用户删除

' 本地IP

Tmp3 = Tmp3 + ":" + vbCrLf + vbTab + "Local: "

'CopyMemory为API函数

CopyMemory Ip_Buf(1), TCP1.TCP_Table(i).dwLocalAddr, 4

Tmp3 = Tmp3 + CStr(Ip_Buf(1)) + "." + _

CStr(Ip_Buf(2)) + "."+ CStr(Ip_Buf(3)) _

+"." + CStr(Ip_Buf(4))

Tmp1 = TCP1.TCP_Table(i).dwLocalPort

' 本地端口

Tmp2 = Tmp1 / 256 + (Tmp1 Mod 256) * 256

' 远程IP

Tmp3 = Tmp3 + ":" + Str(Tmp2) + vbTab + "Remote: "

CopyMemory Ip_Buf(1), TCP1.TCP_Table(i).dwRemoteAddr, 4

Tmp3 = Tmp3 + CStr(Ip_Buf(1)) + "." + CStr(Ip_Buf(2)) _

+ "."+ CStr(Ip_Buf(3)) + "." + CStr(Ip_Buf(4))

' 远程端口

Tmp1 = TCP1.TCP_Table(i).dwRemotePort

Tmp2 = Tmp1 / 256 + (Tmp1 Mod 256) * 256

Tmp3 = Tmp3 + ":" + Str(Tmp2) + vbCrLf

Text1 = Text1 + Tmp3

Next i

Case 50:

MsgBox "系统不支持该API函数": End

Case 87:

MsgBox "无效的参数": End

Case 111:

MsgBox "缓冲区溢出": End

Case 232:

MsgBox "无数据": End

End Select

End Sub

用于删除连接的CLICK事件源代码:

Private Sub delete_Click()

Dim Return1 As Long

If Combo1.ListIndex 0 Then Exit Sub

' 将欲删连接的状态置为值为12

TCP1.TCP_Table(Combo1.ListIndex).dwState = 12

' 执行删除

Return1 = SetTcpEntry(TCP1.TCP_Table(Combo1.ListIndex))

If Return1 = 0 Then

MsgBox "删除成功"

Else

MsgBox "删除失败"

End If

Timer1_Timer

End Sub

2、屏幕监控

当服务器系统发现TCP异常连接时,可通过屏幕监控功能将局域网中被监控工作站的屏幕画面抓取到服务器中并实施相应措施,如对工作站锁机或关机等。此处用到WINSOCK控件,其通讯原理请参阅相关资料,屏幕监控功能用到TCP协议,为了达到更好的效果,可在窗体中加入TIMER控件,设定TIMER事件。

(1) 工作站端

侦听并响应服务器端发出的连接请求和屏幕抓取。其中屏幕抓取功能可通过API函数实现:

Dim a As String

Winsock1.GetData a, vbString

Select Case a

Case "zp"

Picture1.AutoRedraw = True

Picture1.ScaleMode = 1

lDesktop = GetDesktopWindow()

lDC = GetDC(lDesktop)

BitBlt Picture1.hdc, 0, 0, Screen.Width, _

Screen.Height, lDC,0, 0, vbSrcCopy

'获取图像数组

SavePicture Picture1.Image, filename

Winsock1.SendData "okm"

Dim myfile() As Byte

Case "fir" '传之一块图

Open filename For Binary As #1

filelen = LOF(1)

ReDim myfile(1 To blocksize) As Byte

'(const blocksize=3072)

Get #1, , myfile

Winsock1.SendData myfile

curpos = blocksize

Case "next" ‘传其它块

If curpos = filelen Then

Winsock1.SendData "end"

Close #1

Exit Sub

End If

j = curpos + blocksize

If j filelen Then

j = filelen - curpos

Else

j = blocksize

End If

ReDim myfile(1 To j) As Byte

Get #1, , myfile

Winsock1.SendData myfile

curpos = curpos + j

End Select

注意:以上功能在WINSOCK的DataArrival事件中实现。抓取的图象数据量较大,所以需要分块传输。

(2) 服务器端

DataArrival 事件代码:

Dim receivefile() As Byte

ReDim receivefile(bytesTotal) As Byte

Winsock1.GetData receivefile, vbArray + vbByte

'告诉Winsock控件收到的是字节数组类型的数据

If Chr(receivefile(0)) = "o" And _

Chr(receivefile(1)) = "k" And _

Chr(receivefile(2)) = "m" Then

If Dir$(filename) "" Then Kill filename

' 打开文件,准备存储图像

Open filename For Binary As #1

filelen = 0

Winsock1.SendData "fir"

Exit Sub

End If

If Chr(receivefile(0)) = "e" And _

Chr(receivefile(1)) = "n" And _

Chr(receivefile(2)) = "d" Then

Label1.Caption = "end"

Close #1

Picture1.Picture = LoadPicture(filename) '显示图象

Exit Sub

End If

Put #1, , receivefile

Winsock1.SendData "next"

3、其它功能

主要用到一些API函数,如实现屏幕锁定和解锁操作可使用Enable Window,实现关机功能用ExitWindowsEx, 服务器和工作站之间的信息互送用到WINSOCK控件的UDP协议,具体用法请参阅有关资料。

结束语

通过在基本的 *** 监控系统增加入侵检测,就能够极大提高 *** 的整体安全性,使之更灵敏、更智能,大大降低入侵的成功率。

VB 6 与 USB接口的扫描枪

扫描枪的原理和键盘是差不多的,扫描条码后它会自动转换为数字然后模拟通过键盘端口发送到电脑中,就像是人手从键盘中键入这些数字一样。所以对于VB而言,它是无法判断这些数字是通过扫描枪发来还是通过真正的键盘发来的,因此如果把接收的文本框设为只读或锁定,那么就会连扫描枪发来的信息也一起拒之门外的。改用Label也不行,因为它没有键盘事件。

这件事的完美解决 *** 要在扫描枪上找。扫描枪的说明书应该有说明如何自定义数字输出格式的(我用过的就有),你可以在数字前面添加一个特殊的字符,比如~,使数字传送到电脑后变成类似下面的格式:

~1234567890(后面加个回车键)

这样你在文本框的KeyPress事件中先检测是否是~字符,如果不是就拒绝接收,如果是就继续接收直到回车键。

不过,你更好还是允许手工收入为好,扫描枪的设计原理本身就是为了自动输入与手工输入相结合的,否则一旦扫描枪发生故障,连个应急措施度没有。你可以在程序中对输入结果进行检测,比如长度、是否合法字符等,另外一般条形码中都包含校验码的,通过比对校验码和其他数字,可知道是否有错。

请教VB高手一个局干网端口数的问题

一般设为0,当然可以随便,不过更好大于1024,因为以下的通常系统保留的。范围是0--65535.

求IP端口扫描器的VB源码

'4个TEXTBOX控件,2个COMMANDBUTTON控件,一个WINSOCK控件

Dim portnum As Long

Dim start As String

Sub scanningports()

Dim porttwo As Long

portnum = Text1.Text

porttwo = Text2.Text

Command2.Enabled = True

On Error GoTo viriio

Do

portnum = portnum + 1

DoEvents

If start = True Then

'关闭当前WINSOCK

Winsock1.Close

'防止系统冻结

DoEvents

Winsock1.LocalPort = portnum

DoEvents

Text3.Text = portnum

Winsock1.Listen

DoEvents

Else

portnum = 0

Command1.Enabled = True

Text1.Locked = False

Text2.Locked = False

Exit Sub

End If

Winsock1.Close

DoEvents

Loop Until portnum = porttwo

portnum = 0

Command1.Enabled = True

logport.Text = logport.Text vbCrLf "Scanning Ports Done!" vbCrLf

Text1.Locked = False

Text2.Locked = False

viriio:

If Err.Number = 10048 Then

logport.Text = logport.Text vbCrLf "端口" Winsock1.LocalPort " 开启中"

Resume Next

End If

End Sub

Private Sub Command1_Click()

Command2.Enabled = True

If Text1.Text = "" Then

MsgBox "你必须指定开始端口号!"

Exit Sub

End If

If Text2.Text = "" Then

MsgBox "你必须指定一个结束端口号"

Exit Sub

End If

Text1.Locked = True

Text2.Locked = True

Command1.Enabled = False

Winsock1.Close

start = True

Call scanningports

logport.Text = logport.Text vbCrLf "端口" Text1.Text "- " Text3.Text " 已经成功扫描!"

End Sub

Private Sub Command2_Click()

Command2.Enabled = False

start = False

End Sub

用VB实现扫描进程

Private Const LVM_FIRST = H1000

Private Const LVM_GETITEMCOUNT = (LVM_FIRST + 4)

Private Const LVM_GETITEM = (LVM_FIRST + 5)

Private Const LVM_GETSTRINGWIDTH = (LVM_FIRST + 17)

Private Const LVM_GETCOLUMN = (LVM_FIRST + 25)

Private Const LVM_GETITEMTEXT = (LVM_FIRST + 45)

Private Const LVM_GETHEADER = LVM_FIRST + 31

Private Const WC_HEADERA = "SysHeader32"

Private Const WC_HEADER = WC_HEADERA

Private Const HDM_FIRST = H1200 '// Header messages

Private Const HDM_GETITEMCOUNT = (HDM_FIRST + 0)

Private Const HDM_ORDERTOINDEX = (HDM_FIRST + 15)

Private Const PROCESS_QUERY_INFORMATION = 1024

Private Const PROCESS_VM_OPERATION = H8

Private Const PROCESS_VM_READ = H10

Private Const PROCESS_VM_WRITE = H20

Private Const STANDARD_RIGHTS_REQUIRED = HF0000

Private Const MAX_LVMSTRING As Long = 255 '可根椐读取数据长度设置适当的数值

Private Const MEM_COMMIT = H1000

Private Const MEM_RELEASE = H8000

Private Const PAGE_READWRITE = H4

Private Const LVIF_TEXT As Long = H1

Private Type LV_ITEMA

mask As Long

iItem As Long

iSubItem As Long

state As Long

stateMask As Long

pszText As Long

cchTextMax As Long

iImage As Long

lParam As Long

iIndent As Long

End Type

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long

Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long

Private Declare Function VirtualFreeEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long

Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long

Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Private Sub Command1_Click()

Dim lngHwnd As Long

Dim lngHwnd1 As Long

Dim lngHeaderHwnd As Long

Dim lngPId As Long

Dim lngRows As Long

Dim lngCols As Long

Dim lngRow As Long

Dim lngCol As Long

Dim strItem As String

Text1 = ""

lngHwnd1 = FindWindow(vbNullString, "Windows 任务管理器") '获取任务管理器窗口句柄

lngHwnd1 = FindWindowEx(lngHwnd1, 0, "#32770", "") '获取选项卡句柄

lngHwnd = FindWindowEx(lngHwnd1, 0, "syslistView32", "进程") '获取进程列表框句柄

Debug.Print lngHwnd

lngHeaderHwnd = SendMessage(lngHwnd, LVM_GETHEADER, 0, 0) '获取ListView表头句柄

lngRows = SendMessage(lngHwnd, LVM_GETITEMCOUNT, 0, 0) '获取ListView项目数

If lngHeaderHwnd 0 Then

lngCols = SendMessage(lngHeaderHwnd, HDM_GETITEMCOUNT, 0, 0) '获取ListView表头项目数

Else

lngCols = 1

End If

GetWindowThreadProcessId lngHwnd, lngPId '获取与指定窗口关联在一起的一个进程和线程标识符

For lngRow = 0 To lngRows - 1

strItem = ""

For lngCol = 0 To lngCols - 1

strItem = strItem vbTab GetListviewItem(lngHwnd, lngPId, lngCol, lngRow)

Next

Text1 = Text1 " " aa ": " strItem Chr(13) Chr(10)

Debug.Print strItem

Next

' Next

End Sub

Public Function GetListviewItem(ByVal hWindow As Long, ByVal ProcessID As Long, ByVal pColumn As Long, ByVal pRow As Long) As String

Dim Result As Long

Dim myItem As LV_ITEMA

Dim pHandle As Long

Dim pStrBufferMemory As Long

Dim pMyItemMemory As Long

Dim strBuffer() As Byte

Dim Index As Long

Dim tmpString As String

Dim strLength As Long

'******************************

'为动态数组变量重新分配存储空间

'******************************

ReDim strBuffer(MAX_LVMSTRING)

'*****************************************************************************************************

'打开一个现有进程的句柄,返回值Long,如执行成功,返回进程句柄;零表示失败。会设置GetLastError

'Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long

'参数 类型及说明

'dwDesiredAccess Long,指定这个句柄要求的访问 *** 。指定API32.TXT文件中以PROCESS_???开头的一个或多个常数

'bInheritHandle Long,如句柄能够由子进程继承,则为TRUE

'dwProcessId Long,要打开那个进程的进程标识符

'*****************************************************************************************************

pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, ProcessID)

'*****************************************************************************************************

'VirtualAllocEx(目标进程的句柄,0,内存区域的大小,分配类型,新分配内存的存取保护类型)返回所分配页面的基址

'*****************************************************************************************************

pStrBufferMemory = VirtualAllocEx(pHandle, 0, MAX_LVMSTRING, MEM_COMMIT, PAGE_READWRITE)

'*************************************************

'初始化LV_ITEM 结构

'MyItem.iSubItem 列的索引号

'myItem.pszText 数据内容(此处是一个分配的内存地址)

'*************************************************

myItem.mask = LVIF_TEXT

myItem.iSubItem = pColumn

myItem.pszText = pStrBufferMemory

myItem.cchTextMax = MAX_LVMSTRING

'***********************************************************

'把这个结构写入远程进程process's 存储量

'WriteProcessMemory(目标进程的句柄,地址,写入的数据,字节数,0)

'***********************************************************

pMyItemMemory = VirtualAllocEx(pHandle, 0, Len(myItem), MEM_COMMIT, PAGE_READWRITE)

Result = WriteProcessMemory(pHandle, pMyItemMemory, myItem, Len(myItem), 0)

'********************************

'发送消息,得到项目信息和写入内存

'********************************

Result = SendMessage(hWindow, LVM_GETITEMTEXT, pRow, ByVal pMyItemMemory)

Result = ReadProcessMemory(pHandle, pStrBufferMemory, strBuffer(0), MAX_LVMSTRING, 0)

Result = ReadProcessMemory(pHandle, pMyItemMemory, myItem, Len(myItem), 0)

'************************

'把字节列阵变成串和送回它

'************************

tmpString = StrConv(strBuffer, vbUnicode)

If InStr(tmpString, Chr$(0)) 0 Then

tmpString = Left$(tmpString, InStr(tmpString, Chr$(0)) - 1)

End If

tmpString = Trim$(tmpString)

'****************************

'释放分配的内存和关闭进程句柄

'****************************

Result = VirtualFreeEx(pHandle, pStrBufferMemory, 0, MEM_RELEASE)

Result = VirtualFreeEx(pHandle, pMyItemMemory, 0, MEM_RELEASE)

Result = CloseHandle(pHandle)

If Len(tmpString) 0 Then GetListviewItem = tmpString

End Function

Private Sub Form_Load()

End Sub

'加一个Command1

求助高手vb6.0用winsock的TCP/UDP进行端口扫描和一对多通讯的问题怎么解决

Private Sub Form_Load()

'将 LocalPort 属性设置为一个整数。然后调用 Listen *** 。

tcpServer.LocalPort = 1001

tcpServer.Listen

frmClient.Show '显示客户端的窗体。

End Sub

Private Sub tcpServer_ConnectionRequest _

(ByVal requestID As Long)

'检查控件的 State 属性是否为关闭的。如果不是,在接受新的连接之前先关闭此连接。

If tcpServer.State sckClosed Then

tcpServer.Close

End If

'接受具有 requestID 参数的连接。

tcpServer.Accept requestID

End Sub

Private Sub txtSendData_Change()

'名为 txtSendData 的 TextBox 控件中

'包含了要发送的数据。当用户往文本框中键入数据时,使用 SendData *** 发送输入的字符串。

tcpServer.SendData txtSendData.Text

End Sub

Private Sub tcpServer_DataArrival _

(ByVal bytesTotal As Long)

'为进入的数据声明一个变量。

'调用 GetData *** ,并将数据赋予名为 txtOutput的 TextBox 的 Text 属性。

Dim strData As String

tcpServer.GetData strData

txtOutPut.Text = strData

End Sub

frmClient:

Private Sub Form_Load()

'Winsock 控件的名字为 tcpClient。

'注意:要指定远程主机,可以使用

' IP 地址(例如:"121.111.1.1"),也可以使用

'计算机的“好听的名字”如下所示。

tcpClient.RemoteHost = "127.0.0.1"

tcpClient.RemotePort = 1001

End Sub

Private Sub cmdConnect_Click()

'调用 Connect *** ,初始化连接。

tcpClient.Connect

End Sub

Private Sub txtSend_Change()

tcpClient.SendData txtSend.Text

End Sub

Private Sub tcpClient_DataArrival _

(ByVal bytesTotal As Long)

Dim strData As String

tcpClient.GetData strData

txtOutPut.Text = strData

End Sub

0条大神的评论

发表评论