Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 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
Posted
Comments
Richard MacCutchan 10-Oct-11 10:39am    
Duplicate of this question deleted.

1 solution

What do you expect to happen after the line:
VB
sockP.SendData sText

in the above code?
 
Share this answer
 
Comments
Member 4581741 10-Oct-11 11:58am    
sTest are commands sent to the terminal.
Suppose sText is ATE0 then in telnet i am getting ATE0 and then OK.

sockP_DataArrival is triggered once and i get back "ATE0" but not OK.

I tried different commands where i expect more then 1 reply for a command but i am getting databack just once from the terminal.
Richard MacCutchan 10-Oct-11 12:37pm    
My comment was directed at the logic of your code. After that command you fall through into the Sub - how does this work?
Member 4581741 10-Oct-11 14:43pm    
Ok problem is solved. It was me who was making mistake while passing command which i didnt mentioned in this post.

I was just missing new line character while sending commands.

Thanks for posting comments for helping me out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900