how do i check if the terminal is connected?
Cut and paste the terminal text here (with backticks) and remove any tokens before uploading the post.
Donât upload images of text.
Last login: Mon Mar 5 17:14:40 on ttys000
Daniils-Macbook:~ daniilkharlashko$ cd documents
Daniils-Macbook:documents daniilkharlashko$ cd arduino
Daniils-Macbook:arduino daniilkharlashko$ cd librariess
-bash: cd: librariess: No such file or directory
Daniils-Macbook:arduino daniilkharlashko$ cd libraries
Daniils-Macbook:libraries daniilkharlashko$ cd scripts
-bash: cd: scripts: No such file or directory
Daniils-Macbook:libraries daniilkharlashko$ cd blynk
Daniils-Macbook:blynk daniilkharlashko$ cd scripts
Daniils-Macbook:scripts daniilkharlashko$ sh ./blynk-ser.sh
1 ports found. You can specify port manually using -c option
-n Select serial port [ /dev/tty.usbmodem1421 ]:
/dev/tty.usbmodem1421
Resetting device /dev/tty.usbmodem1421...
[ Press Ctrl+C to exit ]
Connecting: GOPEN:/dev/tty.usbmodem1421,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/daniilkharlashko/documents/arduino/libraries/blynk/scripts/certs/server.crt,nodelay
2018/03/05 19:30:22 socat[31323] N opening character device "/dev/tty.usbmodem1421" for reading and writing
2018/03/05 19:30:23 socat[31323] N opening connection to LEN=16 AF=2 188.166.206.43:8441
2018/03/05 19:30:23 socat[31323] N successfully connected from local address LEN=16 AF=2 192.168.1.108:55239
2018/03/05 19:30:23 socat[31323] N trusting certificate, commonName matches
2018/03/05 19:30:23 socat[31323] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/05 19:30:23 socat[31323] N SSL connection compression "none"
2018/03/05 19:30:23 socat[31323] N SSL connection expansion "none"
2018/03/05 19:30:23 socat[31323] N starting data transfer loop with FDs [5,5] and [8,8]
2018/03/05 19:30:23 socat[31323] E read(5, 0x7ffced804e00, 8192): Resource temporarily unavailable
2018/03/05 19:30:23 socat[31323] N exit(1)
Reconnecting in 3s...
Connecting: GOPEN:/dev/tty.usbmodem1421,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/daniilkharlashko/documents/arduino/libraries/blynk/scripts/certs/server.crt,nodelay
2018/03/05 19:30:26 socat[31327] N opening character device "/dev/tty.usbmodem1421" for reading and writing
2018/03/05 19:30:26 socat[31327] N opening connection to LEN=16 AF=2 188.166.206.43:8441
2018/03/05 19:30:27 socat[31327] N successfully connected from local address LEN=16 AF=2 192.168.1.108:55241
2018/03/05 19:30:27 socat[31327] N trusting certificate, commonName matches
2018/03/05 19:30:27 socat[31327] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/05 19:30:27 socat[31327] N SSL connection compression "none"
2018/03/05 19:30:27 socat[31327] N SSL connection expansion "none"
2018/03/05 19:30:27 socat[31327] N starting data transfer loop with FDs [5,5] and [8,8]
2018/03/05 19:30:27 socat[31327] E read(5, 0x7fbabb808800, 8192): Resource temporarily unavailable
2018/03/05 19:30:27 socat[31327] N exit(1)
Reconnecting in 3s...
Connecting: GOPEN:/dev/tty.usbmodem1421,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/daniilkharlashko/documents/arduino/libraries/blynk/scripts/certs/server.crt,nodelay
2018/03/05 19:30:30 socat[31332] N opening character device "/dev/tty.usbmodem1421" for reading and writing
2018/03/05 19:30:30 socat[31332] N opening connection to LEN=16 AF=2 188.166.206.43:8441
2018/03/05 19:30:31 socat[31332] N successfully connected from local address LEN=16 AF=2 192.168.1.108:55245
2018/03/05 19:30:31 socat[31332] N trusting certificate, commonName matches
2018/03/05 19:30:31 socat[31332] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/05 19:30:31 socat[31332] N SSL connection compression "none"
2018/03/05 19:30:31 socat[31332] N SSL connection expansion "none"
2018/03/05 19:30:31 socat[31332] N starting data transfer loop with FDs [5,5] and [8,8]
2018/03/05 19:30:34 socat[31332] E read(5, 0x7fa2bf815c00, 8192): Resource temporarily unavailable
2018/03/05 19:30:34 socat[31332] N exit(1)
Reconnecting in 3s...
Connecting: GOPEN:/dev/tty.usbmodem1421,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/daniilkharlashko/documents/arduino/libraries/blynk/scripts/certs/server.crt,nodelay
2018/03/05 19:30:38 socat[31338] N opening character device "/dev/tty.usbmodem1421" for reading and writing
2018/03/05 19:30:38 socat[31338] N opening connection to LEN=16 AF=2 188.166.206.43:8441
2018/03/05 19:30:38 socat[31338] N successfully connected from local address LEN=16 AF=2 192.168.1.108:55246
2018/03/05 19:30:38 socat[31338] N trusting certificate, commonName matches
2018/03/05 19:30:38 socat[31338] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/05 19:30:38 socat[31338] N SSL connection compression "none"
2018/03/05 19:30:38 socat[31338] N SSL connection expansion "none"
2018/03/05 19:30:38 socat[31338] N starting data transfer loop with FDs [5,5] and [8,8]
Looks like itâs dropping the connection.
socat is obviously running but I donât see sudo before sh ./blynk-ser.sh
Could be that or a recent port change done by Blynk that is not in the script.
Do you know what library version you are using for Blynk?
@Dmitriy any port changes needed for USB connection?
i am not sure what version i am running, with sudo it didnât let me but with sh before ./blynk-ser.sh it worked
Google is everyoneâs friend.
Your error message in Google suggests âtemporary server faultâ.
Either ports blocked at your end or the recent port changes by Blynk.
You need to know all version numbers for everything at all times. Check where you picked up the libraries for the version number. Meanwhile paste blynk-ser.sh here.
my blynk library is 100% 0.5.1 because i saw in my downloads
OK thatâs the latest version but any port changes might not be included because USB is not particularly common. People generally use either the nigthmare ESP shield or simple ESP standalone.
Paste the script.
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT SwSerial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleStream.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "confidential_token_here";
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, millis() / 1000);
}
void setup()
{
// Debug console
SwSerial.begin(9600);
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(Serial, auth);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}
I am very thankful for your help!
I didnâ t want to see the sketch, especially with your token, I wrote:
Whilst we are referring to the sketch it might be worth removing all the USB2TTL stuff like this:
/* Comment this out to disable prints and save space */
//#define BLYNK_PRINT SwSerial
//#include <SoftwareSerial.h>
//SoftwareSerial SwSerial(10, 11); // RX, TX
#include <BlynkSimpleStream.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "confidential_token_here";
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V5, millis() / 1000);
}
void setup()
{
// Debug console
//SwSerial.begin(9600);
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(Serial, auth);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
}
void loop()
{
Blynk.run();
timer.run(); // Initiates BlynkTimer
}
i am not sure what you mean by blynk-ser.sh here. and what do you mean by USB2TTL?
I am just new to this kind of stuff and i wanted to create something simple and then gradually increase the level of difficulty i still donât know any specific keywords .
i have retried the terminal and this came up
Last login: Mon Mar 5 19:28:59 on ttys001
Daniils-Macbook:~ daniilkharlashko$ cd documents
Daniils-Macbook:documents daniilkharlashko$ cd arduino
Daniils-Macbook:arduino daniilkharlashko$ cd libraries
Daniils-Macbook:libraries daniilkharlashko$ vd blynk
-bash: vd: command not found
Daniils-Macbook:libraries daniilkharlashko$ cd blynk
Daniils-Macbook:blynk daniilkharlashko$ cd scripts
Daniils-Macbook:scripts daniilkharlashko$ sh ./blynk-ser.sh
1 ports found. You can specify port manually using -c option
-n Select serial port [ /dev/tty.usbmodem1421 ]:
/dev/tty.usbmodem1421
Resetting device /dev/tty.usbmodem1421...
[ Press Ctrl+C to exit ]
Connecting: GOPEN:/dev/tty.usbmodem1421,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/daniilkharlashko/documents/arduino/libraries/blynk/scripts/certs/server.crt,nodelay
2018/03/05 20:42:43 socat[33048] N opening character device "/dev/tty.usbmodem1421" for reading and writing
2018/03/05 20:42:43 socat[33048] N opening connection to LEN=16 AF=2 188.166.206.43:8441
2018/03/05 20:42:43 socat[33048] N successfully connected from local address LEN=16 AF=2 192.168.1.108:55876
2018/03/05 20:42:44 socat[33048] N trusting certificate, commonName matches
2018/03/05 20:42:44 socat[33048] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/05 20:42:44 socat[33048] N SSL connection compression "none"
2018/03/05 20:42:44 socat[33048] N SSL connection expansion "none"
2018/03/05 20:42:44 socat[33048] N starting data transfer loop with FDs [5,5] and [8,8]
2018/03/05 20:43:08 socat[33048] N socket 2 (fd 8) is at EOF
2018/03/05 20:43:08 socat[33048] N exiting with status 0
Reconnecting in 3s...
Connecting: GOPEN:/dev/tty.usbmodem1421,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/daniilkharlashko/documents/arduino/libraries/blynk/scripts/certs/server.crt,nodelay
2018/03/05 20:43:11 socat[33076] N opening character device "/dev/tty.usbmodem1421" for reading and writing
2018/03/05 20:43:11 socat[33076] N opening connection to LEN=16 AF=2 188.166.206.43:8441
2018/03/05 20:43:11 socat[33076] N successfully connected from local address LEN=16 AF=2 192.168.1.108:55880
2018/03/05 20:43:12 socat[33076] N trusting certificate, commonName matches
2018/03/05 20:43:12 socat[33076] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/05 20:43:12 socat[33076] N SSL connection compression "none"
2018/03/05 20:43:12 socat[33076] N SSL connection expansion "none"
2018/03/05 20:43:12 socat[33076] N starting data transfer loop with FDs [5,5] and [8,8]
2018/03/05 20:43:27 socat[33076] N socket 2 (fd 8) is at EOF
2018/03/05 20:43:27 socat[33076] N exiting with status 0
Reconnecting in 3s...
Connecting: GOPEN:/dev/tty.usbmodem1421,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/daniilkharlashko/documents/arduino/libraries/blynk/scripts/certs/server.crt,nodelay
2018/03/05 20:43:30 socat[33084] N opening character device "/dev/tty.usbmodem1421" for reading and writing
2018/03/05 20:43:30 socat[33084] N opening connection to LEN=16 AF=2 188.166.206.43:8441
2018/03/05 20:43:30 socat[33084] N successfully connected from local address LEN=16 AF=2 192.168.1.108:55883
2018/03/05 20:43:31 socat[33084] N trusting certificate, commonName matches
2018/03/05 20:43:31 socat[33084] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/05 20:43:31 socat[33084] N SSL connection compression "none"
2018/03/05 20:43:31 socat[33084] N SSL connection expansion "none"
2018/03/05 20:43:31 socat[33084] N starting data transfer loop with FDs [5,5] and [8,8]
2018/03/05 20:43:46 socat[33084] N socket 2 (fd 8) is at EOF
2018/03/05 20:43:46 socat[33084] N exiting with status 0
Reconnecting in 3s...
Connecting: GOPEN:/dev/tty.usbmodem1421,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/daniilkharlashko/documents/arduino/libraries/blynk/scripts/certs/server.crt,nodelay
2018/03/05 20:43:49 socat[33089] N opening character device "/dev/tty.usbmodem1421" for reading and writing
2018/03/05 20:43:49 socat[33089] N opening connection to LEN=16 AF=2 188.166.206.43:8441
2018/03/05 20:43:49 socat[33089] N successfully connected from local address LEN=16 AF=2 192.168.1.108:55885
2018/03/05 20:43:50 socat[33089] N trusting certificate, commonName matches
2018/03/05 20:43:50 socat[33089] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/05 20:43:50 socat[33089] N SSL connection compression "none"
2018/03/05 20:43:50 socat[33089] N SSL connection expansion "none"
2018/03/05 20:43:50 socat[33089] N starting data transfer loop with FDs [5,5] and [8,8]
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:11 socat[33089] N socket 2 (fd 8) is at EOF
2018/03/05 20:44:12 socat[33089] N exiting with status 0
Reconnecting in 3s...
Connecting: GOPEN:/dev/tty.usbmodem1421,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/daniilkharlashko/documents/arduino/libraries/blynk/scripts/certs/server.crt,nodelay
2018/03/05 20:44:15 socat[33095] N opening character device "/dev/tty.usbmodem1421" for reading and writing
2018/03/05 20:44:15 socat[33095] N opening connection to LEN=16 AF=2 188.166.206.43:8441
2018/03/05 20:44:15 socat[33095] N successfully connected from local address LEN=16 AF=2 192.168.1.108:55886
2018/03/05 20:44:15 socat[33095] N trusting certificate, commonName matches
2018/03/05 20:44:15 socat[33095] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/05 20:44:15 socat[33095] N SSL connection compression "none"
2018/03/05 20:44:15 socat[33095] N SSL connection expansion "none"
2018/03/05 20:44:15 socat[33095] N starting data transfer loop with FDs [5,5] and [8,8]
Donât be confused by the fact it looks like a URL, the .sh is a shell script that you are running with socat.
It is in the libraries that you downloaded from Blynkâs GitHub.
I could d/l it myself but you already have it hand for pasting here.
The fact you are not familiar with the file suggests you might not have done some of the recommended edits stated in the script file.
Let me know if you struggle to find it in the libraries.
so what do i need to do now>?
Paste here, with backticks, the contents of a file called blynk-ser.sh
that was in the zip file you took from Blynk GitHub.
#!/bin/bash
# Detect script path
pushd `dirname $0` > /dev/null
SCRIPTPATH=`pwd`
popd > /dev/null
# === Edit default options to match your need ===
FROM_TYPE="SER" # SER, TCP
TO_TYPE="SSL" # TCP, SSL
COMM_BAUD=9600
SERV_ADDR=blynk-cloud.com
SERV_PORT_SSL=8441
SERV_PORT_TCP=8442
SERV_PORT_2WAY=8443
LSTN_PORT=8442
SRVR_CERT="$SCRIPTPATH/certs/server.crt"
CLNT_CERT="$SCRIPTPATH/certs/client.pem"
# === Edit the lines below only if absolutely sure what you're doing ===
usage="
This script redirects serial communication to the server.
You can specify port, baud rate, and server endpoint like this:
blynk-ser.sh -c <serial port> -b <baud rate> -s <server address> -p <server port>
The defaults are:
-c,--comm single available port (on Linux, OSX)
COM1 (on Windows)
-b,--baud 9600
-s,--server blynk-cloud.com
-p,--port 8442
If the specified serial port is not found, it will ask to enter another one.
The script also tries to reestablish connection if it was lost.
"
avrdude_warn="Warning: avrdude is running
Avoid uploading sketches and running this script at the same time.
If you didn't run avrdude, maybe it just stuck. You can kill it using:
killall avrdude
"
function detect_conflicts {
# Detect if avrdude is running
if pgrep avrdude; then echo -n "$avrdude_warn"; fi
}
detect_conflicts
# Detect socat
if ! hash socat 2>/dev/null; then
echo "This script uses socat utility, but could not find it."
echo
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo " Try installing it using: sudo apt-get install socat"
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo " Try installing it using: brew install socat"
fi
exit 1
fi
# Execute getopt
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
ARGS=$(getopt -o hf:c:b:l:t:s:p: -l "help,from:,comm:,baud:,listen:,to:,server:,port:,cert:" -n "blynk-gateway.sh" -- "$@");
elif [[ "$OSTYPE" == "darwin"* ]]; then
ARGS=$(getopt hf:c:b:l:t:s:p: $*);
fi
# Bad arguments
if [ $? -ne 0 ];
then
echo -n "$usage"
exit 1
fi
eval set -- "$ARGS";
while true; do
case "$1" in
-h|--help)
shift
echo -n "$usage"
exit 0
;;
####
-f|--from)
shift
if [ -n "$1" ]; then
FROM_TYPE=$1
shift
fi
;;
-c|--comm)
shift
if [ -n "$1" ]; then
COMM_PORT_USER=$1
shift
fi
;;
-b|--baud)
shift
if [ -n "$1" ]; then
COMM_BAUD=$1
shift
fi
;;
-l|--listen)
shift
if [ -n "$1" ]; then
LSTN_PORT=$1
shift
fi
;;
####
-t|--to)
shift
if [ -n "$1" ]; then
TO_TYPE=$1
shift
fi
;;
-s|--server)
shift
if [ -n "$1" ]; then
SERV_ADDR=$1
shift
fi
;;
-p|--port)
shift
if [ -n "$1" ]; then
SERV_PORT_SSL=$1
SERV_PORT_TCP=$1
SERV_PORT_2WAY=$1
shift
fi
;;
--cert)
shift
if [ -n "$1" ]; then
SRVR_CERT=$1
shift
fi
;;
####
--)
shift;
break;
;;
esac
done
# Construct command
GEN_ATTR="-d -d"
TCP_ATTR="nodelay" #,nonblock=1,rcvtimeo=1,sndtimeo=1
SER_ATTR="raw,echo=0,clocal=1,cs8,nonblock=1"
if [[ "$FROM_TYPE" == "SER" ]]; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
COMM_WCARD="/dev/ttyUSB* /dev/ttyACM*"
COMM_STTY="-F"
elif [[ "$OSTYPE" == "darwin"* ]]; then
COMM_WCARD="/dev/tty.usbserial* /dev/tty.usbmodem*"
COMM_STTY="-f"
else
echo "Can't detect OS type!"
exit 1
fi
COMM_FOUND=`ls $COMM_WCARD 2> /dev/null`
COMM_QTY=`printf "%s\n" $COMM_FOUND | wc -l`
if [[ ! "$COMM_PORT_USER" == "" ]]; then
COMM_PORT=$COMM_PORT_USER
elif [[ "$COMM_QTY" == "1" ]]; then
# Select single available port
COMM_PORT=$COMM_FOUND
else
# Ask for serial port interactively
echo "$COMM_QTY ports found. You can specify port manually using -c option"
echo -n "Select serial port [" $COMM_FOUND "]: "
read COMM_PORT
fi
if [ ! -e "$COMM_PORT" ]; then
echo "Can't find port: $COMM_PORT"
echo "Please specify port manually using -c option"
exit 1
fi
echo "Resetting device $COMM_PORT..."
stty $COMM_STTY $COMM_PORT hupcl
# Disable restarting
#stty $COMM_STTY $COMM_PORT -hupcl
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
FROM_ATTR="FILE:$COMM_PORT,$SER_ATTR,b$COMM_BAUD"
elif [[ "$OSTYPE" == "darwin"* ]]; then
FROM_ATTR="GOPEN:$COMM_PORT,$SER_ATTR,ixoff=0,ixon=0,ispeed=$COMM_BAUD,ospeed=$COMM_BAUD,crtscts=0"
fi
elif [[ "$FROM_TYPE" == "TCP" ]]; then
FROM_ATTR="TCP-LISTEN:$LSTN_PORT,reuseaddr,fork,$TCP_ATTR"
else
echo "$FROM_TYPE is not supported."
exit 1
fi
if [[ "$TO_TYPE" == "TCP" ]]; then
echo "Warning: Server connection may be insecure!"
TO_ATTR="TCP:$SERV_ADDR:$SERV_PORT_TCP,$TCP_ATTR"
elif [[ "$TO_TYPE" == "SSL" ]]; then
if [ -e "$SRVR_CERT" ]; then
TCP_ATTR="cafile=$SRVR_CERT,$TCP_ATTR"
else
echo "Warning: $SRVR_CERT not found. Skipping server verification (connection may be insecure)!"
TCP_ATTR="verify=0,$TCP_ATTR"
fi
if [ -e "$CLNT_CERT" ]; then
TCP_ATTR="cert=$CLNT_CERT,$TCP_ATTR"
fi
TO_ATTR="openssl-connect:$SERV_ADDR:$SERV_PORT_SSL,$TCP_ATTR"
elif [[ "$TO_TYPE" == "2WAY" ]]; then
echo "2WAY is not supported yet."
exit 1
else
echo "$TO_TYPE is not supported."
exit 1
fi
# Setup exit handler
trap "echo Exited!; exit;" SIGINT SIGTERM
echo [ Press Ctrl+C to exit ]
while [ 1 ]; do
echo Connecting: "$FROM_ATTR <-> $TO_ATTR"
socat $GEN_ATTR "$FROM_ATTR" "$TO_ATTR"
detect_conflicts
echo Reconnecting in 3s...
sleep 3
done
I have to go now i will talk tommorow thank you
Let me know when you are around tomorrow and we can work through the script you have posted.
@vshymanskyy and @Dmitriy have any of the following port references for USB connections changed and if so what should they be now?
SERV_PORT_SSL=8441
SERV_PORT_TCP=8442
SERV_PORT_2WAY=8443
LSTN_PORT=8442
@Dankharl try changing this line in the script:
TO_TYPE="SSL" # TCP, SSL
to
TO_TYPE="TCP" # TCP, SSL
See port change requirements in the next post.
Yes. In the latest library release - yes.
SERV_PORT_SSL=8441
SERV_PORT_TCP=80
SERV_PORT_2WAY=8443
LSTN_PORT=80