Tells the server to begin listening for an incoming SSH connection.
server.beginSSH()
server.beginSSH(username, password)
username - user's name from the SSH client
password - password from the SSH client
none
#include <SPI.h>
#include <Phpoc.h>
PhpocServer server(22);
boolean alreadyConnected = false; // whether or not the client was connected previously
void setup() {
Serial.begin(9600);
while(!Serial)
;
Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
//Phpoc.begin();
server.beginSSH("root", "1234");
//server.beginSSH("", "");
//server.beginSSH();
Serial.print("SSH server address : ");
Serial.println(Phpoc.localIP());
}
void loop() {
// wait for a new client:
PhpocClient client = server.available();
// when the client sends the first byte, say hello:
if (client) {
if (!alreadyConnected) {
// clear out the transmission buffer:
client.flush();
Serial.println("We have a new client");
client.println("Hello, client!");
alreadyConnected = true;
}
if (client.available() > 0) {
// read the bytes incoming from the client:
char thisChar = client.read();
// echo the bytes back to the client:
server.write(thisChar);
// echo the bytes to the server as well:
Serial.write(thisChar);
}
}
}