Winsock数据到达事件触发一次 [英] Winsock Data Arrival event trigger just once

查看:118
本文介绍了Winsock数据到达事件触发一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我向终端发送命令时,有可能会发送更多的回复.
Winsock_DataArrival在发送第一个答复时仅触发一次.当终端发送第二个答复时,它不会触发.
我通过telnet到终端,可以看到多个回复.

When i send a command to a terminal, there are chances that more than more reply are sent.
Winsock_DataArrival Triggers just once when first reply is sent. Its is not triggering when second reply is sent by the terminal.
I telnet to the terminal and can see multiple replies coming through.

With sockP
  
     If .State <> sckClosed Then
        .Close
     End If
            
    .Protocol = sckTCPProtocol
    .Connect sIPAddress, sIPPort

    Do
      DoEvents
    Loop Until .State = sckConnected Or .State = sckClosed

    sockP.SendData sText

Private Sub sockP_DataArrival(ByVal bytesTotal As Long)

   Dim rData As String
   rData = ""

   sockP.GetData rData, vbString
   txtReplies.text = rData   
   DoEvents

End Sub



DataArrival是事件仅被触发一次.我不知道我在做什么错.

我对vb6中的winsock不太熟悉,目前我无法升级到.net.

请指教.

谢谢



DataArrival is event is just being triggered once. I dont know what am i doing wrong.

I am not much familiar with winsock in vb6 and i cant upgrade to .net at this point.

Please advise.

Thanks

推荐答案

您希望在下一行之后发生什么:
What do you expect to happen after the line:
sockP.SendData sText


在上面的代码中?


in the above code?


这篇关于Winsock数据到达事件触发一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆