Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:51 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Udp to the WwW?

Author Message
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 554
Posted: 06:19am 02 Jun 2023
Copy link to clipboard 
Print this post

Hi, ive testet the webmite udp with a ip adress outside my homenetwork. No success atm. Have anyone tested this also?
Plasma
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 06:54am 02 Jun 2023
Copy link to clipboard 
Print this post

Will your router pass UDP? I don't think they are normally set up to do so by default as it can be a security risk. They normally won't accept UDP connections from outside.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 07:29am 02 Jun 2023
Copy link to clipboard 
Print this post

try sending a UDP message to tassyjim.ddns.net port 6802

It only accepts messages one at a time.

I will add some logging later.
It is also running on a part of my network I don't normally expose so it will not be there for long.




That's going trough two NATs

Jim
Edited 2023-06-02 17:37 by TassyJim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 10:25pm 02 Jun 2023
Copy link to clipboard 
Print this post

I have now put a WEBmite on the net.
It is running a slightly modified version of Peters example.

 '
 OPTION EXPLICIT
 OPTION DEFAULT INTEGER
 DIM remoteIP$, n, lastTime$
 WEB UDP INTERRUPT myUDPint
 'WEB UDP SEND "tassyjim.ddns.net", 6802, "Hello world"
 DO
 LOOP UNTIL n > 100
 
SUB myUDPint
 PRINT "received "+MM.MESSAGE$+" from "+MM.ADDRESS$+" at "+TIME$
 IF remoteIP$ = MM.ADDRESS$  AND LEFT$(lasttime$,5) = LEFT$(TIME$,5) THEN
   INC n
 ELSE
   remoteIP$ = MM.ADDRESS$
   lastTime$ = TIME$
   n = 1
 ENDIF
IF n < 10 AND LEN(MM.MESSAGE$) < 200 THEN
 WEB UDP SEND MM.ADDRESS$,6802,MM.MESSAGE$+" at "+TIME$
ENDIF
END SUB


The biggest risk with having a simple server on the net is how easy it would be to end up with a race condition where a message gets bounced back and forth eating up all your bandwidth and eventually getting banned by your ISP.

The above code should limit a user to 10 hits in any minute.
Not very sophisticated and I will do more but it would be silly announcing the code. That would make it too easy for anyone wanting to play silly games.

Code at the other end is:
'
OPTION EXPLICIT
OPTION DEFAULT INTEGER

WEB UDP INTERRUPT myUDPint
WEB UDP SEND "tassyjim.ddns.net", 6802, "Hello world"
DO
LOOP

SUB myUDPint
PRINT "received "+MM.MESSAGE$+" from "+MM.ADDRESS$+" at "+TIME$
END SUB


It just sends one packet and prints the reply.

This will test your router to see if it has port triggering or port forwarding set up.

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 02:20am 03 Jun 2023
Copy link to clipboard 
Print this post

  Quote  received Hello world from 92.xxx.xxx.xxx at 12:17:11


Did you get the reply?
(Local time which is 02:17 UTC)

Jim
Edited 2023-06-03 12:21 by TassyJim
VK7JH
MMedit   MMBasic Help
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 554
Posted: 04:04am 03 Jun 2023
Copy link to clipboard 
Print this post

No reply
Plasma
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 05:38am 03 Jun 2023
Copy link to clipboard 
Print this post

I received plenty of packets and when I tested it, I was receiving replies OK.

The replies are sent to your public IP port 6802 so it looks like you need to check your router port forwarding

That's the trouble with UDP, not easy to know if it works.


Edit: I can't ping the 92.xxx.xxx.xxx address and a trace gets lost in telefonica.de


Jim
Edited 2023-06-03 15:42 by TassyJim
VK7JH
MMedit   MMBasic Help
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 554
Posted: 10:09am 03 Jun 2023
Copy link to clipboard 
Print this post

Hmm i forwarded the range 6800-8888 to the ip from the mite , dunno why nothing works.
Sorry for flooding, next tests tonight
I totally forget to check the ping 😵‍💫 omg
Plasma
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 11:50am 03 Jun 2023
Copy link to clipboard 
Print this post

  Plasmamac said  Hmm i forwarded the range 6800-8888 to the ip from the mite , dunno why nothing works.

UDP not TCP?

Jim
VK7JH
MMedit   MMBasic Help
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 554
Posted: 12:06pm 03 Jun 2023
Copy link to clipboard 
Print this post

Udp yes
Plasma
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 09:09pm 03 Jun 2023
Copy link to clipboard 
Print this post

The WEBmite UDP server is back up again.

Next silly question.
You do have the server set in options?
OPTION UDP SERVER PORT 6802


Also,
Many ISPs use CGNAT (Commercial Grade NAT) to save on IP addresses.
In Australia Telstra mobile network is one example.

Can you check you WAN IP as reported by your router and advise the first part only.
If it starts with '92.' it looks like a true public ip but starting with '100.' and it indicates CGNAT. There will be other CGNAT ranges.

Some ISPs block all incoming ports unless you request them being opened. Opening the range 6800-8888 is excessive and I suggest just forwarding what is required.

Apart from that, I have run out of ideas.

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 09:17pm 03 Jun 2023
Copy link to clipboard 
Print this post

  Quote  received Hi ! Plasma here from 77.xxx.xxx.xxx at 07:15:34

VK7JH
MMedit   MMBasic Help
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 554
Posted: 09:25pm 03 Jun 2023
Copy link to clipboard 
Print this post

HI Tassyjim

it works ! got reply from your server . i reboot the router and all fine now.

i will now check the runtime if you have nothing against  

480 ms atm .
Edited 2023-06-04 07:33 by Plasmamac
Plasma
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 09:36pm 03 Jun 2023
Copy link to clipboard 
Print this post

Good to see it working.
I noticed that your IP has changed. That means you are on a dynamic IP like most users. That is not a problem.

Jim
VK7JH
MMedit   MMBasic Help
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 03:02am 04 Jun 2023
Copy link to clipboard 
Print this post

  Quote  *received Hi ! Paket  runtime test from 77.xxx.xxx.xxx at 04:37:32  5
* Safety shutdown
>

You exceeded 10 in a minute so it stopped replying and after 100 in an hour, the system shuts down and needs a manual re-start.

A bit crude but offers some protection from a wrongly programmed pico going astray.

Jim
VK7JH
MMedit   MMBasic Help
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 554
Posted: 08:52am 04 Jun 2023
Copy link to clipboard 
Print this post

Yup sry for this, a speedtest
Plasma
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 09:50am 04 Jun 2023
Copy link to clipboard 
Print this post

  Plasmamac said  Yup sry for this, a speedtest


Don't be sorry, it all helps me refine the protection.

It now has a limit of 20 per minute and will restart at the next hour if you overload it too much.

I have plenty of bandwidth.

Jim
VK7JH
MMedit   MMBasic Help
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 554
Posted: 09:32pm 04 Jun 2023
Copy link to clipboard 
Print this post

ok will check  
Plasma
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6100
Posted: 04:08am 07 Jun 2023
Copy link to clipboard 
Print this post

I have shut the echo program down. I needed the pico for a real job.

Jim
VK7JH
MMedit   MMBasic Help
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 554
Posted: 05:59am 07 Jun 2023
Copy link to clipboard 
Print this post

np
Plasma
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024