Link to home
Start Free TrialLog in
Avatar of smurray
smurray

asked on

GetData or PeekData and calling a form to display

I have a program that captures data out of the comm port. I also can TELNET to the device  but when I try and invoke the peekData or GetData It see's nothing. I am using another form to display the data back, Could that be the issue? Here is the code out of the books online of the GetData I am using. Is there any good examples of TCP/IP (telnet)programs out there?
 
Private Sub Winsock1_DataArrival_(ByVal bytesTotal As Long)
    Dim strData As String
    Winsock1.GetData strData
    Text1.Text = strData
End Sub

Here is how it is being called.

Private Sub mnuTelnetOpen_Click()
   
   'Winsock1.RemoteHost = "140.248.152.196"
    Winsock1.RemotePort = 23
    'txtTerm.Text = ""
    Winsock1.Connect
    TCPform.Show vbModal
End Sub

Private Sub Winsock1_Connect()
 Dim PauseTime, Start, Finish, TotalTime
 Dim error1, last1
 
    Winsock1.SendData "root" & Chr(13)
    Beep
    Winsock1.SendData Chr(13)
    Winsock1.SendData Chr(13)
    'MSComm1.InputLen = 0 ' Get all available data
    'MSComm1.Handshaking = 1
     
   
       
     If MSComm1.PortOpen = True Then
     
        Winsock1.SendData "ls" & Chr(13)

Thanks in advance for your help.

-S
ASKER CERTIFIED SOLUTION
Avatar of anthonyc
anthonyc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smurray
smurray

ASKER

Thanks for the tip on the modalm but I still cannot read back from the device. Is there an example on how to GetData during a Telnet session?
what you did looks perfect   I have a telnet OCX of my own, and that's how I made it.