Page 1 of 3

Problems with my model RR

Posted: Sat Oct 10, 2009 6:47 pm
by Vernon
I built a model RR with the intent of controlling it over the internet using a MOD 5270 from netburner as a communications device. The 5270 is connected via RS-232 to an HS12 board that generates the DCC packets and drives an H-bridge. It always works fine sitting here at my PC but at other locations I get intermittant 404 errors. I can go down to the local internet cafe on, say, Monday and it will work fine. Go on Wednesday and I get a 404 error - I can then refresh and get the page sometimes and sometimes not. The intermittant nature of the problem is frustrating and I would like to ask the membership for help with this.

http://www.cttestset.com/camtest.htm

The link is above. The console on the right is served (except for the pictures/buttons) from the MOD 5270. I will leave the lights on so you can try it out - I would like to know if it works (or not) from most locations and any ideas that might cure the intermittant problem.

Re: Problems with my model RR

Posted: Sat Oct 10, 2009 6:52 pm
by Vernon
I will add that it never works from the Blackberry. Gives an HTTP Error 504: Gateway Timeout every time.

Re: Problems with my model RR

Posted: Sun Oct 11, 2009 10:21 am
by rnixon
Most providers I have used try to discourage or even block the ability of your home network connection to be a web server. It could come in the form of blocking port 80 connections, or a more advanced method of actually examining the packets for HTTP GET commands. The first thing you could try is running the web server on a different port number than 80 or 8080 (a common one also).

Use a port number in the function StartHTTP(), such as StartHTTP(81);. Now when you type in the address in the web browser you need to add the port number: "http://www.cttestset.com:81/camtest.htm". Remember the name really represents an IP address, so its the same as saying: 208.83.209.14:81 (or whatever port number you want to use) and identifying the file name. If this works, please let the list know.

Re: Problems with my model RR

Posted: Sun Oct 11, 2009 10:57 am
by Vernon
rnixon wrote:Most providers I have used try to discourage or even block the ability of your home network connection to be a web server. It could come in the form of blocking port 80 connections, or a more advanced method of actually examining the packets for HTTP GET commands. The first thing you could try is running the web server on a different port number than 80 or 8080 (a common one also).

Use a port number in the function StartHTTP(), such as StartHTTP(81);. Now when you type in the address in the web browser you need to add the port number: "http://www.cttestset.com:81/camtest.htm". Remember the name really represents an IP address, so its the same as saying: 208.83.209.14:81 (or whatever port number you want to use) and identifying the file name. If this works, please let the list know.
I use StartHTTP(105). In addition the web camera is on port 90 and it is much more reliable.

I don't use get.

I use the method of loading a simple page:

<HTML>
<HEAD>
</HEAD>
<BODY>
<font size=4><font color="#000000">
<center>
<b><br>
DCC locomotive<br>
Control Console
</b>
<br>
<font size=3>
<!--VARIABLE FooWithParameters(fd,88) -->
<br><br>
<hr width="20%" color="#FF00FF">
Locomotive A speed control
<br>
<A HREF="http://71.84.214.156:105/up.htm">
<img SRC="http://www.cttestset.com/locoup.jpg">
</A><br>
<A HREF="http://71.84.214.156:105/dn.htm">
<img SRC="http://www.cttestset.com/locodn.jpg">
</A><br>
<A HREF="http://71.84.214.156:105/stop.htm"">
<img SRC="http://www.cttestset.com/locostop.jpg">
</A><br>
<hr width="20%" color="#FF00FF">
<A HREF="http://71.84.214.156:105/fwd.htm"">
<img SRC="http://www.cttestset.com/locofwd.jpg">
</A><br>
<A HREF="http://71.84.214.156:105/rev.htm"">
<img SRC="http://www.cttestset.com/locorev.jpg">
</A><br>
<hr width="20%" color="#FF00FF">

Loop Switches
<br>

<A HREF="http://71.84.214.156:105/inner.htm"">
<img SRC="http://www.cttestset.com/inner.jpg">
</A>
<A HREF="http://71.84.214.156:105/outer.htm"">
<img SRC="http://www.cttestset.com/outer.jpg">
</A><br>

</BODY>
</HTML>

Re: Problems with my model RR

Posted: Sun Oct 11, 2009 11:01 am
by Vernon
The variable

<!--VARIABLE FooWithParameters(fd,88) -->

88 in this case is parsed to issue the correct serial commands to the track processor. Below shows the code if the variable is 66 as an example.

if ( v == 66 )
{
if (Alocospeed < 2) Alocospeed = 2;
Alocospeed = Alocospeed - 1;
siprintf(buffer, "<br>Locomotive A speed = %d\r\n", Alocospeed);
writestring(fd,buffer);
printf ("$Lb%03u\n", Alocospeed * 2);
siprintf(buffer, "<br>Time: %02d:%02d", min ,sec);
writestring(fd,buffer);
if (direction == 1) siprintf(dbuffer, "<br>Forward");
if (direction == 0) siprintf(dbuffer, "<br>Reverse");
writestring(fd,dbuffer);
if (railswitch == 1) siprintf(dbuffer, "<br>Inner Loop");
if (railswitch == 0) siprintf(dbuffer, "<br>Outer Loop");
writestring(fd,dbuffer);
putleds( 0x02 );

}

Re: Problems with my model RR

Posted: Sun Oct 11, 2009 11:04 am
by Vernon
I will add that the HTML at cttestset.com/camtest.htm has a frame that uses the numerical IP address and port. It all works some people some of the time so I don't think my ISP is blocking anything.

Re: Problems with my model RR

Posted: Mon Oct 12, 2009 2:52 am
by Kiwinet
Hi Vernon,

I've solved the Window 404 problem on my browser by pressing the back arrow key.
This may suggest it is simply a browser loading problem. Perhaps dynamically refreshing the html code (see NB examples) may make the loading bug go away?



Image

Kind regards

Paul

Re: Problems with my model RR

Posted: Mon Oct 12, 2009 8:36 am
by Vernon
Thanks !

I could not find anything in the examples that is very different from what I am doing. I started with an example and modified it. Do you know of an example that is particularly helpful ?

Are there any Netburner websites hosted on home broadband (I have a 10 megabit cable modem) I could look at ?

I have an inexpensive Netgear router. Would a different router be better for this application ?

I will note that the webcamera generally works fine through the same router/ISP.

Re: Problems with my model RR

Posted: Mon Oct 12, 2009 10:01 am
by rnixon
Vernon,

You don't have control over the GET request. Regardless of what is on your HTML web page, the web browser on the host computer uses the HTTP protocol and sends the GET request (to get your web page). It is definitely possible your ISP could be interfering. Another possibility is the router and your port forwarding settings. I don't think this has anything to do with the devices, NetBurner or Camera. You could try configuring your router so the NetBurner is in a DMZ, and is exposed directly to all internet traffic on the network.

Re: Problems with my model RR

Posted: Mon Oct 12, 2009 10:20 am
by Vernon
The Netburner is both "port forwarded" and is in a DMZ. The camera just has port forwarding.