Difference between revisions of "SimpleWebServer"
Line 14: | Line 14: | ||
It can be tricky to make it work. If it doesn't work there are 2 likely possibilities. The first is that it attached itself to another Ethernet port than the one you specified the IPAddress. To troubleshoot this: | It can be tricky to make it work. If it doesn't work there are 2 likely possibilities. The first is that it attached itself to another Ethernet port than the one you specified the IPAddress. To troubleshoot this: | ||
− | 1) In Solution Explorer, expand down the AdvancedHMIControls project | + | 1) In Solution Explorer, expand down the AdvancedHMIControls project</br> |
− | 2) Expand down the Components folder | + | 2) Expand down the Components folder</br> |
− | 3) Right click the SimpleWebServer.vb and select View Code | + | 3) Right click the SimpleWebServer.vb and select View Code</br> |
− | 4) Go to approximate line 107 and look for this code: | + | 4) Go to approximate line 107 and look for this code:</br> |
Try | Try | ||
Line 26: | Line 26: | ||
Console.WriteLine("SocketException: {0}", e) | Console.WriteLine("SocketException: {0}", e) | ||
End Try | End Try | ||
− | 5) Click in the left margin to place a break point next to the line after "server = New TcpListener(localAddr, m_TCPPort)" | + | 5) Click in the left margin to place a break point next to the line after "server = New TcpListener(localAddr, m_TCPPort)"</br> |
− | 6) Run the application | + | 6) Run the application</br> |
− | 7) When it stops at the breakpoint, hover over localAddr and see what the IP address is | + | 7) When it stops at the breakpoint, hover over localAddr and see what the IP address is</br> |
− | 8) Use the address in your browser along with the port number as shown above | + | 8) Use the address in your browser along with the port number as shown above</br> |
Revision as of 14:44, 9 June 2019
This is a VERY basic component that sends a snap shot of the AdvancedHMI page.
To use:
1) From the Toolbox place the SimpleWebServer on the form
2) Set the TCPPort property to 8080
3) Set SourceForm property to the form you wish to display
4) Start the application
5) In a web browser, enter the IP address of your PC along with the port number
http://192.168.1.111:8080
It can be tricky to make it work. If it doesn't work there are 2 likely possibilities. The first is that it attached itself to another Ethernet port than the one you specified the IPAddress. To troubleshoot this:
1) In Solution Explorer, expand down the AdvancedHMIControls project
2) Expand down the Components folder
3) Right click the SimpleWebServer.vb and select View Code
4) Go to approximate line 107 and look for this code:
Try server = New TcpListener(localAddr, m_TCPPort) <-- place break point here server.Start() server.BeginAcceptTcpClient(AddressOf ConnectionAccepted, server) Catch e As SocketException Console.WriteLine("SocketException: {0}", e) End Try
5) Click in the left margin to place a break point next to the line after "server = New TcpListener(localAddr, m_TCPPort)"
6) Run the application
7) When it stops at the breakpoint, hover over localAddr and see what the IP address is
8) Use the address in your browser along with the port number as shown above