Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect Telnet Output

Status
Not open for further replies.

Billybonga

IS-IT--Management
Jun 22, 2002
72
GB
Hi all,

I'm developing a mini-app for my company that will detect the status of printers via Telnet ... let me explain...

We have a number of OCÉ Printers which when you telnet to their IP on port 7000 it displays the printers status e.g. "Idle", "Paper Jam on Tray 4", "Toner Low" etc.

Using VB and WinSock I created a small test application that will connect and display the telnet screen ... the problem that i face is getting/conditional formatting with the output i.e. I want to detect if the Printer has a Paper Jam for example to make a sound or display a message. Here is what i have so far:

Code:
'Connect to Telnet Port
Private Sub Command1_Click()
wSock.Connect "145.36.24.240", 7000
End Sub


Private Sub wSock_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
wSock.GetData strData
strData = Replace(strData, vbLf, "")
strData = Replace(strData, vbCr, vbNewLine)
Label1.Caption = Label1.Caption & strData & vbNewLine
Debug.Print ">> " & strData
If Label1.Caption = "Idle" Then
Label2.Visible = False
End If

End Sub

The label caption displays "Idle" (or the current status of the printer but then if the status changes it doesn't refresh - it just adds the new status below Idle - I am also unable to determine if Label1.Caption = "Idle"

I have also tried using a textbox but this gives a couple of block icons, then the word Idle.

Can anyone help?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top