SimpleWebServer

From AdvancedHMI
Revision as of 14:44, 9 June 2019 by 98.121.200.169 (talk)
Jump to: navigation, search

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