diff --git a/main.c b/main.c index 8a9cdc72..8c6dd48f 100644 --- a/main.c +++ b/main.c @@ -1578,6 +1578,31 @@ void get_tlm_fox() { printf("Error: %s \n", strerror(errno)); error = 1; sleep(2.0); // sleep if socket connection refused + + // try again + error = 0; + if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + printf("\n Socket creation error \n"); + error = 1; + } + + memset( & serv_addr, '0', sizeof(serv_addr)); + + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(PORT); + + // Convert IPv4 and IPv6 addresses from text to binary form + if (inet_pton(AF_INET, "127.0.0.1", & serv_addr.sin_addr) <= 0) { + printf("\nInvalid address/ Address not supported \n"); + error = 1; + } + + if (connect(sock, (struct sockaddr * ) & serv_addr, sizeof(serv_addr)) < 0) { + printf("\nConnection Failed \n"); + printf("Error: %s \n", strerror(errno)); + error = 1; + // sleep(1.0); // sleep if socket connection refused + } } if (error == 1) ; //rpitxStatus = -1; diff --git a/rpitx.py b/rpitx.py index c3af11c8..60ca15d2 100644 --- a/rpitx.py +++ b/rpitx.py @@ -86,7 +86,7 @@ if __name__ == "__main__": time.sleep(4); # was 8 GPIO.output(txLed, txLedOff) - time.sleep(2) + time.sleep(1) if (transmit):