Hi,
I am using PuTTY to connect to an RPï zero, via, Win 10, vb.net, USB, like so:
Dim sftp As New SftpClient(hostA.local", "pi", "raspberry")
sftp.Connect()
'remote file we want to read
Dim s As String = sftp.ReadAllText("/home/pi/text.txt")
MessageBox.Show(s)
sftp.Disconnect()
This works great.
I also have a "Host B" and a "Host C", all RPi zeroes with USB connections.
Every minute or so, i need to retrieve the content of the text file that is created by the Pi zeroes.
The question is, should i connect and disconnect evry time, or should/can i leave the connections open,
all 3 at the same time ?
thx,
Paul
Re: PuTTY connection
I don't know quite what you're trying to do.
But from the sounds of it, you are just retrieving a text file from each of the three Pis.
I would either:
(1) If the Win10 PC is on all the time, create a shared folder and have the Pis use Samba to write the text files directly into the share, then the PC doesn't have to go get them at all.
(2) Create Samba shares on the Pis, and have the PC get the files from those shared folders.
But from the sounds of it, you are just retrieving a text file from each of the three Pis.
I would either:
(1) If the Win10 PC is on all the time, create a shared folder and have the Pis use Samba to write the text files directly into the share, then the PC doesn't have to go get them at all.
(2) Create Samba shares on the Pis, and have the PC get the files from those shared folders.
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.
The purpose of a little toe is to ensure you keep your furniture in the right place.
Re: PuTTY connection
Wow, Samba ?
Are you referring to the dance moves or is that a piece of software ?
I'll see if I can find it .
thx,
Paul
Are you referring to the dance moves or is that a piece of software ?
I'll see if I can find it .
thx,
Paul
Re: PuTTY connection
I can do Samba, my wife is Brazilian and a good dance teacher, however : What is Samba
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.
The purpose of a little toe is to ensure you keep your furniture in the right place.
Re: PuTTY connection
From what i understand, after reading some stuff about samba, i fail to see how that is going to be "better" than the Putty solution.
But, i may be wrong.
This is what i am doing:
- Start Putty session on win 10
- Connect via USB to 3 pi zeroes (that simultaneous question is still my original topic starter)
- Those pi zeroes are assembled to be input terminals, where numbers are inputted, written to a txt file.
- Every minute i run a visual studio program on the desktop, that collects the data in those txt files.
- Those data are processed and projected on a screen.
What could samba do to improve this setup ?
thx,
Paul
But, i may be wrong.
This is what i am doing:
- Start Putty session on win 10
- Connect via USB to 3 pi zeroes (that simultaneous question is still my original topic starter)
- Those pi zeroes are assembled to be input terminals, where numbers are inputted, written to a txt file.
- Every minute i run a visual studio program on the desktop, that collects the data in those txt files.
- Those data are processed and projected on a screen.
What could samba do to improve this setup ?
thx,
Paul
Re: PuTTY connection
Why ?
How ?- Connect via USB to 3 pi zeroes (that simultaneous question is still my original topic starter)
What ? How ? Why ?- Those pi zeroes are assembled to be input terminals, where numbers are inputted, written to a txt file.
What desktop ? Collect how ?- Every minute i run a visual studio program on the desktop, that collects the data in those txt files.
Where ? What screen ?- Those data are processed and projected on a screen.
It depends on your answers.What could samba do to improve this setup ?
If you give good answers to the above questions somebody will surely be able to give you some advice,
at the moment it does not make sense why you start Putty to connect via USB because Putty uses the network.
I could try to guess but that may make the situation more confused.
The road to insanity is paved with static ip addresses
Re: PuTTY connection
I'm sure there is a misunderstanding here, everything should be clear with these lines:
Dim sftp As New SftpClient(hostA.local", "pi", "raspberry") : this is set up with PuTTY, 3 times for 3 zeroes: HostA, HostB, HostC are their names
sftp.Connect()
'remote file reading (also 3 times for 3 zeroes)
Dim s As String = sftp.ReadAllText("/home/pi/text.txt") : here is where i read the contents of the text file(s)
(MessageBox.Show(s) : this symbolises the processing which is of course more complicated.)
sftp.Disconnect()
This works perfectly.
Would samba do this better?, there are only 4 lines of code in vb.net, and none on the RPi zeroes.
Not more difficult than this.
Paul
Dim sftp As New SftpClient(hostA.local", "pi", "raspberry") : this is set up with PuTTY, 3 times for 3 zeroes: HostA, HostB, HostC are their names
sftp.Connect()
'remote file reading (also 3 times for 3 zeroes)
Dim s As String = sftp.ReadAllText("/home/pi/text.txt") : here is where i read the contents of the text file(s)
(MessageBox.Show(s) : this symbolises the processing which is of course more complicated.)
sftp.Disconnect()
This works perfectly.
Would samba do this better?, there are only 4 lines of code in vb.net, and none on the RPi zeroes.
Not more difficult than this.
Paul
Re: PuTTY connection
I'm not understanding how PuTTY fits into this.
SFTP just needs an SFTP client on the Windows machine and an SFTP service running on the Pis.
It looks like you're using the SSH.NET library.
As the connections are secure, I see no reason to close the connections between reads for security reasons. Performance wise, I can't imaging there is a significant difference either way.
SFTP just needs an SFTP client on the Windows machine and an SFTP service running on the Pis.
It looks like you're using the SSH.NET library.
As the connections are secure, I see no reason to close the connections between reads for security reasons. Performance wise, I can't imaging there is a significant difference either way.
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.
The purpose of a little toe is to ensure you keep your furniture in the right place.
Re: PuTTY connection
OK, i am using the SSH library on the laptop and nothing on the Pi zero.
I have to use something, to create the 3 connections.
As response times are important, i thought it better not to have any extra software running on the pi.
I can use pi 3b 's, but that makes the project much more expensive.
Closing or not closing the connection: OK i can time how long it takes.
The question remains, will it work with 3 connections open simultaneously?
Why don't i test that ?
Well i have assembled the first terminal, and wrote a python program for it.
That works.
Before i assemble 2 or more extra terminals, i would like to have some
indication that it will run for hours without a problem or performance degradation.
I have no experience with writing networking apps.
Paul
I have to use something, to create the 3 connections.
As response times are important, i thought it better not to have any extra software running on the pi.
I can use pi 3b 's, but that makes the project much more expensive.
Closing or not closing the connection: OK i can time how long it takes.
The question remains, will it work with 3 connections open simultaneously?
Why don't i test that ?
Well i have assembled the first terminal, and wrote a python program for it.
That works.
Before i assemble 2 or more extra terminals, i would like to have some
indication that it will run for hours without a problem or performance degradation.
I have no experience with writing networking apps.
Paul
Re: PuTTY connection
You must have the sshd service running on the Pi Zeros.
The Visual Basic code you have posted twice creates the connections. There's no need to create additional connections with PuTTY, they have no effect on running the VB program.
Re: PuTTY connection
1) You are using a PC, in that case using pscp (https://www.chiark.greenend.org.uk/~sgt ... atest.html) is much simpler.DPaul wrote: ↑Wed Aug 01, 2018 6:34 amOK, i am using the SSH library on the laptop and nothing on the Pi zero.
I have to use something, to create the 3 connections.
As response times are important, i thought it better not to have any extra software running on the pi.
I can use pi 3b 's, but that makes the project much more expensive.
Closing or not closing the connection: OK i can time how long it takes.
The question remains, will it work with 3 connections open simultaneously?
Why don't i test that ?
Well i have assembled the first terminal, and wrote a python program for it.
That works.
Before i assemble 2 or more extra terminals, i would like to have some
indication that it will run for hours without a problem or performance degradation.
I have no experience with writing networking apps.
Paul
2) You do not need to assemble "terminals" if you are using pscp
3) You can run multiple pscp sessions between two systems
4) pscp does encryption and authorization.
5) but if you really want to use sftp then you can also use psftp
The road to insanity is paved with static ip addresses
Re: PuTTY connection
Before I get totally confused:
1. https://www.chiark.greenend.org.uk/~sgt ... atest.html
This is where i downloaded putty.
I have difficulty imagining anything simpler
I start putty, give the 3 host adresses (I can even save them, so no typing)
I can start the monitoring program on the zeroes via putty, once and leave them running.
The zeroes shut down by themselves, when i type a "secret code" on the terminal keypad.
They are assembled terminals because they are designed to capture a specific kind of events.
Each terminal is manned by a different person who captures the data by keypad, with some input validation going on etc...
2. Maybe i can do without putty. The fact of plugging the zero via usb into the PC, creates a connection.
I have not figured out how yet.
3.Perhaps i should take a look at "psftp"., but i do not need encryption, authorisation...etc. This is a closed system, totally under my control.
I could dream of additional features, by intervening on the Zeroes from the PC at specific moments. But then KISS.
Paul
1. https://www.chiark.greenend.org.uk/~sgt ... atest.html
This is where i downloaded putty.
I have difficulty imagining anything simpler

I start putty, give the 3 host adresses (I can even save them, so no typing)
I can start the monitoring program on the zeroes via putty, once and leave them running.
The zeroes shut down by themselves, when i type a "secret code" on the terminal keypad.
They are assembled terminals because they are designed to capture a specific kind of events.
Each terminal is manned by a different person who captures the data by keypad, with some input validation going on etc...
2. Maybe i can do without putty. The fact of plugging the zero via usb into the PC, creates a connection.
I have not figured out how yet.
3.Perhaps i should take a look at "psftp"., but i do not need encryption, authorisation...etc. This is a closed system, totally under my control.
I could dream of additional features, by intervening on the Zeroes from the PC at specific moments. But then KISS.
Paul
Re: PuTTY connection
PuTTY uses the ssh protocol on the Pi0 to start a terminal session. When you start a program over ssh this program will be terminated if the connection is terminated (for any reason). To ensure that the program keeps running can use nohup.DPaul wrote: ↑Wed Aug 01, 2018 8:17 amBefore I get totally confused:
1. https://www.chiark.greenend.org.uk/~sgt ... atest.html
This is where i downloaded putty.
I have difficulty imagining anything simpler
I start putty, give the 3 host adresses (I can even save them, so no typing)
I can start the monitoring program on the zeroes via putty, once and leave them running.
With PuTTY you can use keys so that you do not need to login to the Pi0.
Do you shut down the Pi0 or do you terminate your program ?The zeroes shut down by themselves, when i type a "secret code" on the terminal keypad.
That implies that you capture information.They are assembled terminals because they are designed to capture a specific kind of events.
Each terminal is manned by a different person who captures the data by keypad, with some input validation going on etc...
In other words, you want to use ethernet gadget mode on the Pi0 to be able to connect via the network to the Pi0.2. Maybe i can do without putty. The fact of plugging the zero via usb into the PC, creates a connection.
I have not figured out how yet.
Are you aware that the distance is limited to the maximum length of the USB cable ?
Are you aware that these will be point to point connections, you will have multiple ethernet interfaces on your computer.
ftp is a primitive file transfer protocol, sftp is a "secure" ftp using ssh, psftp is the PuTTY supplied PC version of sftp client. ftp requires user interaction. The following example does not ask for password because it is using my keys.3.Perhaps i should take a look at "psftp"., but i do not need encryption, authorisation...etc. This is a closed system, totally under my control.
Code: Select all
C:\Users\Ernst>psftp pi@raspi1
Using username "pi".
Remote working directory is /home/pi
psftp> get readme.txt
remote:/home/pi/readme.txt => local:readme.txt
psftp> exit
C:\Users\Ernst>
Code: Select all
C:\Users\Ernst>pscp pi@raspi1:readme.txt .
readme.txt | 0 kB | 0.0 kB/s | ETA: 00:00:00 | 100%
C:\Users\Ernst>pscp -q pi@raspi1:readme.txt .
C:\Users\Ernst>
A very simple method to intervene is to have your program look for a file, you can use the name of the file or the contents of the file. In this example the program looks for a file named "STOP" in the home directory which is created from the command line on the PC.I could dream of additional features, by intervening on the Zeroes from the PC at specific moments. But then KISS.
Code: Select all
C:\Users\Ernst>plink pi@raspi1 touch STOP
C:\Users\Ernst>plink pi@raspi1 ls -l STOP
-rw-r--r-- 1 pi pi 0 Aug 1 11:39 STOP
C:\Users\Ernst>
The road to insanity is paved with static ip addresses
Re: PuTTY connection
Some good ideas there:
1. No need for USB cables longer than 150 cm.
2. I stop the zeros (secret code) as "sudo shutdown -h now"
3. I do not actually copy a file from the Pi0 's, i read the files ,
and transform the content into varables for further processing on the PC.
4 . I do nothing in command mode on the PC, everything from code vb.net
5. The idea of intervening on the Pi0 by creating a file with a special name has crossed my mind,
but have not figured out yet what sfpt.xxxxx command that would be.
Then i would need the Pi0 (python) to monitor that "arrival".
6. Will try to find examples of the pscp stuff
Paul
1. No need for USB cables longer than 150 cm.
2. I stop the zeros (secret code) as "sudo shutdown -h now"
3. I do not actually copy a file from the Pi0 's, i read the files ,
and transform the content into varables for further processing on the PC.
4 . I do nothing in command mode on the PC, everything from code vb.net
5. The idea of intervening on the Pi0 by creating a file with a special name has crossed my mind,
but have not figured out yet what sfpt.xxxxx command that would be.
Then i would need the Pi0 (python) to monitor that "arrival".
6. Will try to find examples of the pscp stuff
Paul