Pages: [1]   Go Down
Author Topic: Make arduino visible to modem for port forwarding?  (Read 568 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've got it on 192.168.0.13 and I need to forward it's port (84) but since it is currently invisible to the modem, I can't select it to send the port 84 traffic to. Can someone give me a hand here? I'll post the code if you think it will help..

Here's the code:
Code:

#include <SPI.h>
#include <Ethernet.h>
#include <Servo.h>

byte mac[] = {
  0x90, 0xA2, 0xDA, 0x00, 0x32, 0x46 }; //physical mac address
byte ip[] = {
  192, 168, 0, 13 }; // ip in lan
byte gateway[] = {
  192, 168, 0, 1 }; // internet access via router
byte subnet[] = {
  255, 255, 255, 0 }; //subnet mask
Server server(84); //server port

String readString, servo1;

Servo myservo1;  // create servo object to control a servo
//////////////////////

void setup(){

  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  //enable serial data print
  Serial.begin(9600);
  myservo1.attach(7);
  Serial.println("bot21"); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  Client client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string
          readString += c;
        }

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString);

          //readString looks like "GET /?-1500-1500 HTTP/1.1"

          if (readString.length() >0) {
            Serial.println(readString);

            servo1 = readString.substring(7, 11);

            Serial.println(servo1);

            int n1;

            char carray1[6];
            servo1.toCharArray(carray1, sizeof(carray1));
            n1 = atoi(carray1);

            myservo1.writeMicroseconds(n1);

            //myservo.write(n);
            readString="";
          }
          ///////////////////

          //now output HTML data header
          client.println("HTTP/1.1 204 Zoomkat");
          client.println();
          client.println();
          delay(1);
          //stopping client
          client.stop();

          /////////////////////
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}
Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 928
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The last three DSL modems I had have had the same problem.  I looked closely and there was a check box that let me enter the ip address directly.  I first limited the DSL address pool to 192.0.1.0 - .45 and placed my arduinos above 200 (I don't have a reason for this, just did it) and the checked the box.  I was then able to forward any one of the arduinos.
Logged

Trying to keep my house under control http://www.desert-home.com/

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I've got it on 192.168.0.13 and I need to forward it's port (84) but since it is currently invisible to the modem, I can't select it to send the port 84 traffic to.

There's no particular reason it should be visible to the modem (as you put it) because you are not using DHCP. Just type the address in (192.168.0.13) and forward port 84 to that.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You probably need to give more information on your "modem" to get better help.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pages: [1]   Go Up
Jump to: