communication with pink outside of network
dwbowen
Posts: 30
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!
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 Savage
Parallax Tech Support
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 Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
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 Savage
Parallax Tech Support
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!
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.
Which uses TCP, not UDP. Using UDP on a port that has an application using TCP on the same port is fine.
cheerio!
thanks!
thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
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