Evening all,
I have sort of asked this question before in relation to socklib, but i would like to try some what different approach.
Does any one know if i can connect two devices over the internet (not WIFI) and pass data between them using BBC Basic.
Kind regards Ric
Passing information over the web
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Passing information over the web
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
- hellomike
- Posts: 184
- Joined: Sat 09 Jun 2018, 09:47
- Location: Amsterdam
Re: Passing information over the web
Of course unaware of what your previous answers were, both BB4W and BBCSDL have example client.bbc and server.bbc proggy's to chat between two machines.
I.e. it does connect two devices over the internet.
Regards,
Mike
I.e. it does connect two devices over the internet.
Regards,
Mike
-
- Posts: 272
- Joined: Tue 18 Jun 2024, 09:32
Re: Passing information over the web
By "different approach" do you mean you don't want to use socklib at all? I wouldn't recommend that: socklib provides a compatible interface despite the underlying mechanisms being very different on different platforms.
There are currently four different versions of socklib, for BB4W, BBCSDL the Console Mode editions and the Raspberry Pi Pico W edition of BBC BASIC. If you compare the code of those four libraries you will find that they are significantly different, yet they provide a substantially identical interface to your programs.
You are, of course, at liberty to do it any way you want, but by choosing not to use the supplied libraries you forgo compatibility between platforms, and are likely to find it more difficult to receive support.
-
- Posts: 272
- Joined: Tue 18 Jun 2024, 09:32
Re: Passing information over the web
Or indeed two different processes running on the same machine. Sockets are one of the few methods of Inter-Process Communication (IPC) supported on virtually every platform, in addition to their use for communicating over a Local Area Network (LAN) or the Internet (WAN).
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Passing information over the web
Thanks,
I have tried socklib with great success when I'm attached to my WiFi, but when I walk off up the street in loses connection once out of range. I would like to be able to speak to a rpi attached to my WiFi from where ever I am in the country.
Kind regards Ric
I have tried socklib with great success when I'm attached to my WiFi, but when I walk off up the street in loses connection once out of range. I would like to be able to speak to a rpi attached to my WiFi from where ever I am in the country.
Kind regards Ric
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 272
- Joined: Tue 18 Jun 2024, 09:32
Re: Passing information over the web
Do you have a static WAN address? If you do, what you want to achieve is straightforward: just replace the LAN address that you are currently connecting to with your WAN address (you will probably also need to configure your router to forward the port you are using). Then it will work when away from home (anywhere in the world) just as it does when at home, so long as you have an internet connection.
So for example if you are currently connecting to 192.168.1.234:5678 (where 192.168.1.234 is the IP address and 5678 is the port) connect instead to 123.45.67.89:5678 (where 123.45.67.89 is your static WAN address) and configure your router to forward incoming connections on port 5678 to address 192.168.1.234 on your LAN.
The nice thing is that having made this change it will still work when at home and connected via your house WiFi, the connection will succeed despite the WAN address being used. I do this all the time with my 'net connected' utilities.
If you don't have a static WAN address, your life would be made easier if you obtained one (I can't advise on that because I don't know what part of the world you are from)! But the alternative is to use a service like Duck DNS to map a domain name to your dynamic WAN address.
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Passing information over the web
Thanks Richard, I don't know whether I have static or not, but I assume not, I'll look into it and get back to you for further advice. I live relatively local

Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 272
- Joined: Tue 18 Jun 2024, 09:32
Re: Passing information over the web
If you're in the UK one of the easiest ways of getting a static WAN address is to use Zen Internet as your ISP. As well as probably being the best ISP of the bunch, and invariably winning the Which? Recommended Broadband Provider accolade, they still seem to state that "A single, static IPv4 address is available free of charge with all of Zen's broadband services" here.
(Note that I have no connection with Zen other than being a relatively happy customer. They aren't perfect, and I have had reason to complain on a couple of occasions, but I doubt that there is anybody better providing internet connectivity to the home in the UK - and the static IP address is a killer.)
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Passing information over the web
As suspected I don't have a static IP address
but I have looked in to duckdns which seams to offer a service that matches my requirements. The reviews are flakey, but I will only need connection on return from holiday etc...
Thanks again, I'll be back soon.
Ps I don't think the ZEN route would be possible, TV, phones etc are linked to our current provider (and the wife would go mad)
Thanks again, I'll be back soon.
Ps I don't think the ZEN route would be possible, TV, phones etc are linked to our current provider (and the wife would go mad)
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 200
- Joined: Tue 17 Apr 2018, 21:03
Re: Passing information over the web
Just to change tack slightly, is it possible to find the socket number associated with a listening socket, if say socket% has been zeroed before connected% has been established. I realise this should never be needed, and indeed my program doesn't/can't require this information. But is it possible?
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023