our new projector has a web interface as well as telnet (for some reason) I'm not sure if the web interface has an API
Anyway thought it would be nice of me, instead of using a remote - to develop a small application thatll turn the projector on and off.
I've wrote the program but it doesnt seem to work as intended (probably to do with my lack of coding fu) doesn't help the fact i've no idea what the program is doing when its running (would be handy to see a telnet window as its doing its stuff)
here's the code im trying to use well the sub that i pass a value to anyway
The form is just two huge buttons saying ON OFF respectivelyCode:Public Sub projectorcontrol(ByVal onoroff) Dim client As Net.Sockets.TcpClient Dim sr As IO.StreamReader Dim sw As IO.StreamWriter Dim ns As Net.Sockets.NetworkStream Dim response As String 'connecting to a server client = New Net.Sockets.TcpClient Try client.Connect(projectorip, 10000) ' 10000 is the port number Catch e As Exception MessageBox.Show("Failed to connect: " & e.ToString, "Error") Return End Try ns = client.GetStream sr = New IO.StreamReader(ns, System.Text.Encoding.ASCII, True) ' this sends our commands to the server sw = New IO.StreamWriter(ns) ' and this will read server's response sw.WriteLine("****" & ControlChars.CrLf) ' send pin number sw.Flush() sw.WriteLine(onoroff & ControlChars.CrLf) ' on or off is c00 on, c02 off response = sr.ReadLine() End Sub


LinkBack URL
About LinkBacks


