Raspberry Pi Communication

Discussions related to the code libraries supplied with BB4W & BBCSDL
Ric
Posts: 200
Joined: Tue 17 Apr 2018, 21:03

Raspberry Pi Communication

Post by Ric »

Hi all,

I have recently taken the plunge in to Raspberry Pi and have a project lined up that requires me to use my laptop to communicate with the Pi, I wish to do this over the wifi and eventually put an app on my phone and dispense with the laptop. My question is, can i connect wirelessly with the Pi from my laptop?
The Pi is connected to the wifi and so is my laptop.
All i want to pass between the two is one array with 26 elements.

Kind Regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Hated Moron

Re: Raspberry Pi Communication

Post by Hated Moron »

Ric wrote: Sat 04 Nov 2023, 20:22 My question is, can i connect wirelessly with the Pi from my laptop?
Of course you can. The laptop will need to know the IP address of the Pi, so your life would be made a little easier if that's a static address rather than one allocated dynamically by DHCP.

Alternatively you could specify the receiving device by name rather than IP address, if your router acts as a DNS server (which it probably does).
All i want to pass between the two is one array with 26 elements.
You don't say what kind of array, so that could be anything from 26 bytes to 260 bytes, but either way it's easily sendable as a single packet so you won't even need to bother with splitting it up into packets at the sending end and reassembling them at the receiving end.

It's such a trivial application you probably only need the Help documentation as a guide. But you could adapt the code in the programs client.bbc and server.bbc, supplied with both BBC BASIC for Windows and BBC BASIC for SDL 2.0 in the examples/general/ directory.
Ric
Posts: 200
Joined: Tue 17 Apr 2018, 21:03

Re: Raspberry Pi Communication

Post by Ric »

Thanks Richard for the speedy response,

However, my definition of trivial and yours clearly differ. I have loaded the server program on to my lap top and the client on to the Pi 3 and run both programs. The result is "couldn't connect to server". When i type the IP address to start the client off, should all the numbers be 3 digits?(xxx.001.yyy.zzz or will xxx.1.yyy.zzz do?) Please be gentle with the response, until 4pm today i thought a socket was something you put a 13amp plug in.
Kind regards Ric

Both devices are connected to the internet via wifi. Or at least as far as i understand. I can browse google on them both.

ps. just had a thought, could it be something to do with the firewall? That stops things getting through, yes? If it is im doomed, because i have no idea how to change it or even access it. Heres hoping its not related.
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Hated Moron

Re: Raspberry Pi Communication

Post by Hated Moron »

Ric wrote: Sun 05 Nov 2023, 19:36 However, my definition of trivial and yours clearly differ.
I would call it 'trivial' if you need no prior experience of that kind of application, and all the information you need is in the Help documentation.
I have loaded the server program on to my lap top and the client on to the Pi 3 and run both programs. The result is "couldn't connect to server".
That is likely to mean the address you entered wasn't correct. What happens if you ping that same address, do you get a response? If it doesn't respond to a ping, you can be pretty sure the address wasn't right.
should all the numbers be 3 digits?(xxx.001.yyy.zzz or will xxx.1.yyy.zzz do?)
Either is fine, leading zeroes aren't significant.
ps. just had a thought, could it be something to do with the firewall?
So long as Windows realises that your network is indeed a private Local Area Network (not a public network) I wouldn't expect it to block communication. You might get a popup asking you to allow it, but that's all.

But I do worry about security suites / virus scanners. They can sometimes block perfectly legitimate actions, and in my experience can do more harm than good. Do you have anything like McAfee or Norton or Avast installed? If so try temporarily disabling any 'protection' which might be blocking access.
Ric
Posts: 200
Joined: Tue 17 Apr 2018, 21:03

Re: Raspberry Pi Communication

Post by Ric »

Thanks again for the swift response, the IP address was correct, I can't "ping" it, I have no idea what that means, it was the one that the server program produces. By way of chance my brother in law came round on his way somewhere and he twiddled a few things (2 permissions to do with windows) and low and behold it now works.

Kind regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Hated Moron

Re: Raspberry Pi Communication

Post by Hated Moron »

Ric wrote: Sun 05 Nov 2023, 22:59 he twiddled a few things (2 permissions to do with windows) and lo and behold it now works.
Strange, that's not something I have ever encountered. What settings changes were needed? I will add them to the Help documentation so should anybody else experience the same difficulty they will be able to find the solution.