EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Changing http Port 80

Started by joejaworski January 10, 2009
Does anyone know a way to dynamically change the http port from 80 to
something else? I'm running an RCM3700 on DC9.62.

The reason for this is that my customers want to access my
rabbit-based product from outside their local LAN via the internet,
and don't want to tie up the http port on their static IP address.

> Does anyone know a way to dynamically change the http port from 80 to
> something else? I'm running an RCM3700 on DC9.62.

Change the port define from a constant into a simple 'word' variable.
Then you
can assign to it at runtime... or at least before you start accepting
connections.
If you want to change it _while_ running, you'll need to shutdown the HTTP
server (so it closes the socket it is listening on) (not sure how to do
that), change
the value of the variable, then restart so the listen uses the new socket
number.

#define HTTP_PORT my_http_port

#use http.lib

word my_http_port; // Port # where HTTP server listens

main()
{
my_http_port = 2900;
sock_init();
http_init();
tcp_reserveport( HTTP_PORT ); /* actually uses variable. */

. . .
}

>
> The reason for this is that my customers want to access my
> rabbit-based product from outside their local LAN via the internet,
> and don't want to tie up the http port on their static IP address.
>

Most firewalls have a "port forwarding" option. You specify a WAN port
number
(facing the cruel Internet) and pair it with an internal IP addy and port
number.
For instance, my public (external) port 8080 goes to my Solaris box port
80 while
external port 80 goes straight to a little Rabbit BL2000 port 80. And the
BL2000
has no virus protection! ;)
all the best,
*the other brian

No, tcp_reserveport() allows pending connections to a socket that is
already opened. It has nothing to do with port assignment.

The newer routers (especially Linksys) no longer allow specifying a
LAN port during port forwarding. The result is that you must use the
same tcp port for both sides (LAN and WAN) of the IP connection.

--- In r..., wittb@... wrote:
>
> > Does anyone know a way to dynamically change the http port from 80 to
> > something else? I'm running an RCM3700 on DC9.62.
>
> Change the port define from a constant into a simple 'word' variable.
> Then you
> can assign to it at runtime... or at least before you start accepting
> connections.
> If you want to change it _while_ running, you'll need to shutdown
the HTTP
> server (so it closes the socket it is listening on) (not sure how to do
> that), change
> the value of the variable, then restart so the listen uses the new
socket
> number.
>
> #define HTTP_PORT my_http_port
>
> #use http.lib
>
> word my_http_port; // Port # where HTTP server listens
>
> main()
> {
> my_http_port = 2900;
> sock_init();
> http_init();
> tcp_reserveport( HTTP_PORT ); /* actually uses variable. */
>
> . . .
> }
>
> >
> > The reason for this is that my customers want to access my
> > rabbit-based product from outside their local LAN via the internet,
> > and don't want to tie up the http port on their static IP address.
> > Most firewalls have a "port forwarding" option. You specify a WAN port
> number
> (facing the cruel Internet) and pair it with an internal IP addy and
port
> number.
> For instance, my public (external) port 8080 goes to my Solaris box port
> 80 while
> external port 80 goes straight to a little Rabbit BL2000 port 80.
And the
> BL2000
> has no virus protection! ;)
> all the best,
> *the other brian
>

Never mind... I figured out how to do this. There is a #define called
HTTP_PORT in http.lib.
--- In r..., "joejaworski" wrote:
>
> No, tcp_reserveport() allows pending connections to a socket that is
> already opened. It has nothing to do with port assignment.
>
> The newer routers (especially Linksys) no longer allow specifying a
> LAN port during port forwarding. The result is that you must use the
> same tcp port for both sides (LAN and WAN) of the IP connection.
>
>
> --- In r..., wittb@ wrote:
> >
> > > Does anyone know a way to dynamically change the http port from
80 to
> > > something else? I'm running an RCM3700 on DC9.62.
> >
> > Change the port define from a constant into a simple 'word'
variable.
> > Then you
> > can assign to it at runtime... or at least before you start accepting
> > connections.
> > If you want to change it _while_ running, you'll need to shutdown
> the HTTP
> > server (so it closes the socket it is listening on) (not sure how
to do
> > that), change
> > the value of the variable, then restart so the listen uses the new
> socket
> > number.
> >
> > #define HTTP_PORT my_http_port
> >
> > #use http.lib
> >
> > word my_http_port; // Port # where HTTP server listens
> >
> > main()
> > {
> > my_http_port = 2900;
> > sock_init();
> > http_init();
> > tcp_reserveport( HTTP_PORT ); /* actually uses variable. */
> >
> > . . .
> > }
> >
> > >
> > > The reason for this is that my customers want to access my
> > > rabbit-based product from outside their local LAN via the internet,
> > > and don't want to tie up the http port on their static IP address.
> > >
> >
> > Most firewalls have a "port forwarding" option. You specify a
WAN port
> > number
> > (facing the cruel Internet) and pair it with an internal IP addy and
> port
> > number.
> > For instance, my public (external) port 8080 goes to my Solaris
box port
> > 80 while
> > external port 80 goes straight to a little Rabbit BL2000 port 80.
> And the
> > BL2000
> > has no virus protection! ;)
> >
> >
> > all the best,
> > *the other brian
>

Memfault Beyond the Launch