sockets

How to stop server socket using ctrl+c in Python

How to stop server socket using ctrl+c in Python Question: When i run my server, when server is listening, there is no way to stop the server rather than closing the terminal. I tried to handle ctrl+c using KeyboardInterrupt, but it doesnt work. I can terminate the script using ctrl+break but i dont know how …

Total answers: 2

Chat Server with Python Socket Server and Android Client

Chat Server with Python Socket Server and Android Client Question: I am trying to create a simple Chat Server that runs on Python.I am having difficulties in getting a connection between my Android App and my Python Socket Server. I am not getting any response so I dont really know what the problem is. The …

Total answers: 1

UnicodeDecodeError in client server communication when accessing Desktop

UnicodeDecodeError in client server communication when accessing Desktop Question: I want to write a reverse shell like netcat. Everything works fine, but after several commands typed in, the client machine throws an error. I managed to identify the problem. When I change to the Desktop directory on the server, for example C:/Users/Desktop and I type …

Total answers: 1

What does if x: mean in Python

What does if x: mean in Python Question: I have the following code segment in python if mask & selectors.EVENT_READ: recv_data = sock.recv(1024) if recv_data: data.outb += recv_data else: print(f"Closing connection to {data.addr}") Would I read this as: ‘if mask and selectos.EVENT_READ are equivalent:’ And similarly: ‘if recv_data is equivalent to true:’ Help is greatly …

Total answers: 2

TCP server in a docker swarm Deployment and docker swarm load balancing

TCP server in a docker swarm Deployment and docker swarm load balancing Question: I am trying to understand how the docker swarm does the load balancing and how it effects the design of the socket server (since the server has to accept the client connection to get the socket object that it uses to return …

Total answers: 1

WinError 10057 – Python TCP Server is not receiving client connections from localhost

WinError 10057 – Python TCP Server is not receiving client connections from localhost Question: I have this python server code here, which is waiting to receive a message digest and an encrypted message from a python client. Clientside socket: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s=socket.socket() s.connect((HOST, PORT)) s.sendall(transmit) Server Side: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: …

Total answers: 2

python check socket receive within other loop — non-blocking?

python check socket receive within other loop — non-blocking? Question: I know the code to wait for socket in a loop like this. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind((host, port)) data, addr = s.recvfrom(1024) data = data.decode(‘utf-8’) print("Message from: " + str(addr)) print("From connected user: " + data) com = data data = data.upper() data = …

Total answers: 1

Send a def with sockets in python

Send a def with sockets in python Question: I have a problem with sockets, I wanna sent the especifications about my pc in a chat created with sockets, but when I use the sentence send() with the function the compiler throw this error… How can I send that information? Thanks. This is the server code. …

Total answers: 1

Python non-blocking socket

Python non-blocking socket Question: Hi I am trying to create a very simple peer-to-peer chatting program in python. The first user can runs the server.py program below to bind to a socket. import sys import socket import select import threading # Bind to socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((‘127.0.0.1’, 11111)) s.listen() def …

Total answers: 1