I'm currently using VB (2010 Express) to send commands to an AMX controller.
Although it is working... some what. I'm not sure if I'm doing it the correct way or if there is a better way.
The AMX controller is listening on port 8888 for a "REQUEST" with a number after it. From a browser I can type "http://192.168.1.32:8888/REQUEST1" and the AMX controller handles request 1. And the browser displays a message "Function 1 received" (generated by the AMX controller code).
Although at this time I don't care what the webpage says, I'm using DownloadString() to send the request that executes the command. In doing so the controller is getting the "request" but I'm getting an exception. Is there a better way to do this so it will only through an exception if the ip address is invalid?
Code:
Dim RetrivedIP As String = "192.168.2.32"
Dim Command As String = ("http://" & RetrivedIP & ":8888/REQUEST1")
Try
Dim client As WebClient = New WebClient
Dim reply As String = client.DownloadString(Command)
textbox1.text = ("Never makes it here")
Catch ex As Exception
'DO NOTHING
textbox1.text = ("Exception")
End Try
Thanks for the help in advance.
Ken
Although it is working... some what. I'm not sure if I'm doing it the correct way or if there is a better way.
The AMX controller is listening on port 8888 for a "REQUEST" with a number after it. From a browser I can type "http://192.168.1.32:8888/REQUEST1" and the AMX controller handles request 1. And the browser displays a message "Function 1 received" (generated by the AMX controller code).
Although at this time I don't care what the webpage says, I'm using DownloadString() to send the request that executes the command. In doing so the controller is getting the "request" but I'm getting an exception. Is there a better way to do this so it will only through an exception if the ip address is invalid?
Code:
Dim RetrivedIP As String = "192.168.2.32"
Dim Command As String = ("http://" & RetrivedIP & ":8888/REQUEST1")
Try
Dim client As WebClient = New WebClient
Dim reply As String = client.DownloadString(Command)
textbox1.text = ("Never makes it here")
Catch ex As Exception
'DO NOTHING
textbox1.text = ("Exception")
End Try
Thanks for the help in advance.
Ken