Shop OBEX P1 Docs P2 Docs Learn Events
communication with pink outside of network — Parallax Forums

communication with pink outside of network

dwbowendwbowen Posts: 30
edited 2008-08-31 13:52 in BASIC Stamp
Hello All,

I am attempting to set up a system in which a stamp will send UDP messages to another stamp via pink modules. I have this system working nicely inside my network using the following programs:

send....
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM12}


RX PIN 14
TX PIN 15

Baud CON 396

nbvar VAR BYTE(4)
dist0 VAR WORD
dist1 VAR WORD
dist2 VAR WORD
dist3 VAR WORD

main:

PULSOUT 0, 5
PULSIN 0, 1, dist0
PULSOUT 1, 5
PULSIN 1, 1, dist1
PULSOUT 2, 5
PULSIN 2, 1, dist2
PULSOUT 3, 5
PULSIN 3, 1, dist3

nbvar(0) = (dist0/100)
nbvar(1) = (dist1/100)
nbvar(2) = (dist2/100)
nbvar(3) = (dist3/100)

SEROUT TX, Baud, [noparse][[/noparse]"!NB0WBI:192.168.1.50", CLS]
SEROUT TX, Baud, [noparse][[/noparse]"!NB0WBM:",STR nbvar\4,CLS]
SEROUT TX, Baud, [noparse][[/noparse]"!NB0SB"]

GOTO main

receive...
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM14}


RX PIN 14
TX PIN 15

Baud CON 396

nbvar VAR BYTE(4)

main:

SEROUT TX, Baud, [noparse][[/noparse]"!NB0RBM"]
SERIN RX, Baud, 250, timeout, [noparse][[/noparse]STR nbvar\4\CLS]

PULSOUT 12, ((nbvar(1)*2)+1800-(nbvar(0)*2))
PULSOUT 13, ((nbvar(3)*2)+1900-(nbvar(2)*2))

PAUSE 17

GOTO main

Timeout:
DEBUG "Communication Timeout!"
END

I would like to use these programs to send the UDP to a the stamp/pink from an outside network. I understand that because there is a router there is likely a firewall that will prevent this communication. I have been in contact with the network administrator here and I believe he set up 'Port Forwarding' so that the pink can be detected outside the network. He setup a URL and when I type it into the browser of a computer outside of the network the factory default for the pink module comes up. So I thought the logical solution would be to type the new URL into my program here:

SEROUT TX, Baud, [noparse][[/noparse]"!NB0WBI:new.url.org", CLS] rather than.... SEROUT TX, Baud, [noparse][[/noparse]"!NB0WBI:192.168.1.50", CLS]

But, this does not appear to be working. Is this the correct way to do this? Any ideas on what I am doing wrong?

cheers!

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-08-08 17:54
    The web traffic you see on the browser is on port 80, which is what he probably forwarded. The UDP traffic is on another port (10000 by default) which may not have been forwarded by your network admin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • dwbowendwbowen Posts: 30
    edited 2008-08-08 18:40
    Hey Chris,

    Thanks for the reply. So would it work to ad a line in the send program to specify the port?

    something like:

    SEROUT TX, Baud, [noparse][[/noparse]"!NBOWBP: 80", CLS] rather than.... SEROUT TX, Baud, [noparse][[/noparse]"!NBOWBP: 10000", CLS] ?

    or should I have him forward port 10000?

    cheers!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-08-08 23:39
    Well, my reply was based on you not mentioning what ports were forwarded. I assumed port 10000 was not forwarded.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • dwbowendwbowen Posts: 30
    edited 2008-08-09 00:19
    The url the network administrator set up ends in :80. Which I assume means that port 80 was the one that is forwarded. Are there any settings on the pinks or in the program that need to be changed to enable this sort of communication?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-08-11 15:21
    There is no setting on the PINK that would overcome this…If you do not forward the UDP Port then it will be blocked by your system. You have to forward any ports being used.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • dwbowendwbowen Posts: 30
    edited 2008-08-11 20:05
    Hi,

    I have confirmed that it is port 80 that the network administrator forwarded. I have set the Stamp to Stamp UDP message port defaults on both pinks to 80. But still no luck. Does the port on the sending pink side need to be forwarded as well? I did not think this was necessary with one way communication?

    Is it even possible for a pink to send a UDP message to a url rather than an IP address such as:

    SEROUT TX, Baud, [noparse][[/noparse]"!NB0WBI:new.url.org", CLS] rather than SEROUT TX, Baud, [noparse][[/noparse]"!NB0WBI:192.168.1.50", CLS]

    I am making this assumption based on the fact that when I type 192.168.1.50 into the web browser of a computer inside the network the factory default page comes up... and when I type new.url.org into the browser on an outside computer the factory default page comes up..... and of course when I send UDPs to the pink inside the network using the 192.168.1.50 the communication works perfectly... Seems logical to me to swap the IP for the URL but apparently there is something I am missing. Should I have the network administrator use numbers rather then the url? One other thing to note when I type new.url.org into a computer inside of the network I am prompted to enter a password. Could this be something? Any Ideas would be greatly appreciated.

    cheers!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-08-11 21:31
    Okay, I wouldn’t recommend using port 80 for UDP stuff, but besides that by using the URL rather than the IP Address you would normally put yourself in a situation of having to have a DNS server to do the IP lookup. The PINK Module uses the IP Address for that field anyway, not the URL.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • dwbowendwbowen Posts: 30
    edited 2008-08-11 22:36
    So you mean that we should forward port 10000 rather than 80? And it should be set up to go directly to the IP rather than the URL?
  • dwbowendwbowen Posts: 30
    edited 2008-08-12 21:13
    Hi,

    So why wouldn't you recommend using port 80 for UDP stuff? Could I please have some clarification before I have the network administrator change it to 10000?

    cheers!
  • angrekangrek Posts: 5
    edited 2008-08-12 21:59
    Just a quick note. You browsed to the other computer. That's using TCP so we know that he has TCP forwarded. In a firewall setup, forwarding TCP and forwarding UDP are two different things. Testing browsing ensures that he's forwarding one, but not the other. Might want to verify with the other person that they are indeed forwarding UDP.

    Ok, a second note. Get rid of the URL and use the IP for now until you know it works with the IP. If the IP changes, change your code, but keep it as simple as possible until you figure out what is working and what is not. Lowest common denominator. (edit: I didn't realize Chris answered this above, sorry.)

    Fine, a third note, and I'm not sure this one will work. There are tools that do a UDP ping that you can use. This may or may not work because it's not a standard ping. If the application doesn't respond to random UDP traffic then it won't work.

    Anyway, just some thoughts. Hope it helps.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-08-13 00:11
    Port 80 is typically used for connecting to Web Servers. Thus you probably shouldn't use it for your port.
  • angrekangrek Posts: 5
    edited 2008-08-13 02:03
    allanlane5 said...
    Port 80 is typically used for connecting to Web Servers. Thus you probably shouldn't use it for your port.

    Which uses TCP, not UDP. Using UDP on a port that has an application using TCP on the same port is fine.
  • dwbowendwbowen Posts: 30
    edited 2008-08-13 02:24
    I guess just to be on the safe side we are going to try switching to port 10000. Although the communication works fine using port 80 as the UDP default on the pinks within the network. I tried sending the UDP from an outside network directly to the current Dynamic DNS IP setup by the administrator rather than the URL. No dice... It is my understanding that this number changes randomly which is why the administrator had to setup the dynamic DNS URL which I was attempting to use the first time. If it is not apparent I am fairly clueless when it comes to how networks work. Any and all input is greatly appreciated.

    cheerio!
  • dwbowendwbowen Posts: 30
    edited 2008-08-13 03:39
    Sorry if this is a stupid questions but does the current Dynamic DNS IP address of the modem need to match the IP of the pink in order for it to receive a UDP to it from outside the network?

    thanks!
  • dwbowendwbowen Posts: 30
    edited 2008-08-14 16:12
    Tried forwarding port 10000 still not working. Does a port on the sending side need to be forwarded as well?

    thanks,
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-08-14 17:03
    I would have no way of knowing if you sending system filters outbound traffic on that port. This is where it helps to have detailed knowledge of the network and how these systems work. Each system is unique.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • be80bebe80be Posts: 56
    edited 2008-08-31 13:52
    just a idea if you have your stamp setup on a ip like 192.168.0.50 thats forward to the net it would have address say 63.233.234.2
    now if you want to go to it with say firefox and it's on port 10000 you would do that like this http://63.233.234.2:10000
    and that would get you the stamp that tells firefox the ip and the port The ip you have is inside but when you forward you will be using the router ip . The computer I'm on now has i ip 192.168.0.6 but to get to it from the net you 63.246.243.177 hope this helps
Sign In or Register to comment.