Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:50 02 Jul 2025 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 : Webmite: UDP question

Author Message
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2931
Posted: 07:59pm 30 Jun 2025
Copy link to clipboard 
Print this post

Hopefully someone out there can confirm a few things for me while I am away from all my Mites!

I was recently successful in being able to get two Webmites talking to each other (via UDP) by following the example in the PicoMite User Manual. By doing so, the mites were simply getting DHCP issued IP addresses.

A quick search on TBS revealed that static IP addresses could be assigned and this would be much better for my intended use case. So, on further investigation I found that in the manual it states that you can also set a 'name' by using:

OPTION WIFI ssid$, passwd$,[name$] [,ipaddress$, mask$,gateway$]

The questions I have are relating to the 'name$' parameter.

1: Is it possible to 'interrogate' what the name is (if set) on the local Webmite by using something like: print mm.info$(name)

2: can the command:
  WEB UDP SEND addr$, port, data$
(used on the other webmite) make reference to the name$ parameter of the Webmite you wish to talk to?
I ask, because the manual states "In this case the IP address must
be specified and can be either a numeric address (eg, "192.168.1.147") or a
normal text address (eg, "google.com")

3: are there any other uses (on either Webmite) where the name$ parameter is used?


Really would appreciate anyones feedback with the above - I will not be back with my Mites for another 48hours or so, hence I am unable to play or explore......
 
grumpyoldgeek
Newbie

Joined: 30/07/2018
Location: United States
Posts: 36
Posted: 03:28am 01 Jul 2025
Copy link to clipboard 
Print this post

Just a quick observation, it works better long term to have your router's dhcp server to reserve an IP address for your device rather than using a static IP.
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2931
Posted: 05:08am 01 Jul 2025
Copy link to clipboard 
Print this post

  Quote  Just a quick observation, it works better long term to have your router's dhcp server to reserve an IP address for your device rather than using a static IP.


Many thanks for your response. If I understand this correctly; currently my router has a reserve pool of addresses that it doesn't use for DHCP. Each Webmite will hence be set to a static IP within the appropriate range that is not used by DHCP.

My ideal scenario is for the 'master' webmite to be able to scan any 'slave' webmites on the LAN network and list their IP address and preferably list the name$ too.

This is all part of a crazy idea I have for a magazine article - a new 'TermMite' that has some rather nice features..........
Edited 2025-07-01 15:09 by WhiteWizzard
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6266
Posted: 05:45am 01 Jul 2025
Copy link to clipboard 
Print this post

Most routers have the ability to configure a device with the same IP whenever it connects via DHCP.
This has the advantage that if you change routers and end up on a different IP range, the devices will get a valid IP instead of being lost in the wilderness.
This is my preferred way of doing things.

I haven't tried to use the pico name for connecting but when I added a pico to my host file, I could connect to it using the name for telnet and ping etc.

If you are setting up fixed IPs, just give the master pico a text file with the list of slave addresses and names. If you call it a hosts file, you will be doing things like the big boys.

Jim
VK7JH
MMedit
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2931
Posted: 05:53am 01 Jul 2025
Copy link to clipboard 
Print this post

Hi Jim,

Thanks (and great to hear from you!).

Makes sense regarding 'not getting lost in the wilderness' (should routers be changed); however, this is exactly the reason I want to be able to 'scan' the network as the 'list of slave addresses' stored at the master would then be incorrect. This wouldn't be a problem however IF the master could use the slave's name$ parameter in the UDP SEND command.

Really wish I had access to a couple of PicoW's right now...
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6266
Posted: 08:03am 01 Jul 2025
Copy link to clipboard 
Print this post

Computers talk to a DNS server to convert the name into an address.
The hosts file on a Windows PC is checked first and if an entry is found, that is used. If not found, the PC asks the DNS server.
If your router can be configured to work as a local name server, that is one way. If not, you have to provide a DNS server because the internal device names will never get into a WWW DNS.
Even if your pico knows the name of it's friends, there has to be a DNS to convert it to IP numbers.

My main router could be interrogated to give me the names/IPs but it requires security that the pico won't do.

My other router can be configured to serve the name data but I am not going to mess with it.

Hope you aren't melting over there. Down to zero again tonight here!

Jim
VK7JH
MMedit
 
adcockm
Newbie

Joined: 03/05/2025
Location: United States
Posts: 4
Posted: 09:07am 01 Jul 2025
Copy link to clipboard 
Print this post

There's another option for what you're trying to do, but I don't think it's supported in WebMite.

UDP allows for broadcast messages to all devices in a network, as mentioned here. So if your local network range was something like 192.168.2.xxx you could send a broadcast message to 192.168.2.255 on a certain port, and as long as your server was listening on that port (and the UDP packets didn't get lost, which they can, so probably best to have a few retries built in), then it would pick up the message the client had broadcast out to the ether. You'd probably want to do a little handshake thing at that point, where the server sent a message back to the client, and they exchanged names, addresses, or whatever makes sense. Doing it this way means you really don't need to care about what network you're on, or how it's set up, as long as both the server and client(s) are on the same network, and the client can just use it's own IP address that it was given, and peel off the last number and replace it with 255 to broadcast.

I'm just not sure WebMite's UDP routines allow for sending a broadcast message like this, since it seems to require a specific option when the call is made, and I don't see anything like that mentioned in the manual. Kind of a shame, since that's one of the things that makes UDP useful. It's also fast, but there's no guarantee of transmission like there is with TCP (since the connection has to be made before you can send or receive data).
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3348
Posted: 02:08pm 01 Jul 2025
Copy link to clipboard 
Print this post

  grumpyoldgeek said  Just a quick observation, it works better long term to have your router's dhcp server to reserve an IP address for your device rather than using a static IP.


Not sure why this would be categorically true. I have used fixed IP addresses on various little IOT devices for 20+ years. I have replaced a router in this period--just make sure that you keep the same base IP range. If I replace a device, I just give it the same IP address (or a new one if there is a reason to).

~
Edited 2025-07-02 00:10 by lizby
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025