Cannot create a tcp connection on linux in C++

Advertisements At first, here is my source code : #include "server.h" #include <netinet/in.h> #include <unistd.h> #include <thread> #include <iostream> #include <arpa/inet.h> #include <sys/socket.h> Server::Server(int port) { m_Port = port; int server_socket = socket(AF_INET, SOCK_STREAM, 0); sockaddr_in server_address; server_address.sin_family = AF_INET; server_address.sin_port = htons(port); server_address.sin_addr.s_addr = INADDR_ANY; bind(server_socket, (sockaddr *)&server_address, sizeof(server_address)); listen(server_socket, SOMAXCONN); m_Socket = server_socket;… Read More Cannot create a tcp connection on linux in C++

How to send encrypted files over internet in TCP sockets python 3

Advertisements I am trying to send an encrypted file over TCP sockets in python, I don’t want to have to encrypt the message, save it in %TEMP% and then send it (it could fill up hard drive space). I am following this code I found online at: https://gist.github.com/giefko/2fa22e01ff98e72a5be2 Here is my server code: from random… Read More How to send encrypted files over internet in TCP sockets python 3

how to access docker service in localhost

Advertisements I creates a simple service with docker image. how I want to access it in localhost of my system. docker service create –name my-app –replicas 3 -p 9090:8000 my-app-image docker service ls ID NAME MODE REPLICAS IMAGE PORTS ojvi1m6f8b41 my-app replicated 3/3 my-app-image:latest *:9090->8000/tcp docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES… Read More how to access docker service in localhost

How can I add an IP address in a AWS CLI with out exporting

Advertisements I am running below command to ingress in was-cli, it is working fine if I provide IP address, but I want it to know IP and pass it. I was trying something like below but it is not helping aws ec2 authorize-security-group-ingress –group-id sg-123456778 –protocol tcp –port 22 –cidr echo "$(curl https://checkip.amazonaws.com)/32" –profile xyzzy… Read More How can I add an IP address in a AWS CLI with out exporting

Java cant edit thread stopwatch timeout

Advertisements Hey I created this code for timeout in my tcp communication, but after I run thread, I can’t change the end time? any ideas? public class Timer extends Thread{ ThreadLocal<Long> endTime= new ThreadLocal<>() { @Override public Long initialValue() { return System.currentTimeMillis()+1000; } }; private Client client; public void resetTimer(){ endTime.set((System.currentTimeMillis())+1000); } Timer(Client client){ this.client=client;… Read More Java cant edit thread stopwatch timeout