服务端CODE:
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Load()
textsendVisible = False
textgetVisible = False
WinsockserverLocalPort = 1024
WinsockserverListen
End Sub
Private Sub textsend_Change()
WinsockserverSendData textsendText
End Sub
Private Sub Winsockserver_Close()
WinsockserverClose
'End
End Sub
Private Sub Winsockserver_ConnectionRequest(ByVal requestID As Long)
textsendVisible = True
textgetVisible = True
If WinsockserverState <> sckClosed Then WinsockserverClose
WinsockserverAccept requestID
End Sub
Private Sub Winsockserver_DataArrival(ByVal bytesTotal As Long)
Dim tmpstr As String
WinsockserverGetData tmpstr
textgetText = tmpstr
End Sub
客户端CODE:
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
WinsockclientConnect
End Sub
Private Sub Command3_Click()
WinsockclientSendData textsendText & vbCrLf
End Sub
Private Sub Command4_Click()
'WinsockclientClose
End Sub
Private Sub Form_Load()
textsendVisible = False
textgetVisible = False
WinsockclientRemotePort = 1024
'WinsockclientRemoteHost = "19216813"
textsendText = ""
textgetText = ""
Text1Text = "19216813"
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub Winsockclient_Close()
WinsockclientClose
End
End Sub
Private Sub winsockclient_Connect()
textsendVisible = True
textgetVisible = True
Command2Visible = False
End Sub
Private Sub winsockclient_DataArrival(ByVal bytesTotal As Long)
Dim tmpstr As String
WinsockclientGetData tmpstr
textgetText = tmpstr
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)