Questions tagged [python-sockets]

For questions related to the sockets module in the Python standard library, or more broadly socket programming in Python.

The Python library comes with a HOWTO document for sockets programming:

Socket Programming HOWTO — Python 3.x documentation

The standard library is well-documented:

socket - Low-level networking interface

Like the title suggests, sockets are the basic facility for network connections, and on Unix, several other types of interprocess connections. Beginners who want to use a particular application-level protocol should often try to find an existing higher-level library for that instead of programming directly with sockets.

506 questions
1
vote
1 answer

python pipe subprocess i/o over socket

I know there are similar questions out there, but I'm having trouble with this concrete example, and haven't found a good answer. I'm trying to set up a remote backup server for dar, along these lines. I've asked a separate question about doing…
Aryeh Leib Taurog
  • 5,370
  • 1
  • 42
  • 49
1
vote
0 answers

Sending numbers from Pure Data - numbers adding up instead of staying separate

I've got a very simple set up in Pure Data: it creates a local host socket and sends a number through this socket. The number comes either from a Vslider or a Number box. Pure Data This data is then received in Python through the Socket module. It…
OndBoc
  • 9
  • 2
1
vote
1 answer

Working with sockets with multiprocessing + asyncio

I want to process clients in different processes asynchronously, that is, each process can process many client connections asynchronously. The code I have at the moment: import os, socket import asyncio from multiprocessing import Process,…
1
vote
2 answers

Is a python socket connection safe?

I have built a python script that uses python socket to build a connection between my python application and my python server. I have encrypted the data sent between the two systems. I was wondering if I should think of any other things related to…
user20513644
1
vote
0 answers

python socket / how do i send datas in a row to server from client?

im having a hard time understanding how socket works. im trying to send multiple datas to server at once or in a row. i tried send-receive in sequence and it works but with this method, i have to send meaningless strings from server to client. the…
wookidookik123
  • 79
  • 2
  • 10
1
vote
0 answers

creating a udp client but its not returning any response,should I need to create a server if I am using localhost

I have created a udp client import socket target_host = "127.0.0.1" target_port = 80 # create a socket object client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # send some data …
noobintech
  • 21
  • 3
1
vote
0 answers

socket chat room python - crashes right after a file transfer from client to server

I've created a chat room in python using socket (a server, any number of clients) the thing is that everything works flawlessly until a client sends a file, even the file transfer is completed on both the ends but the server side just freezes, i…
Arun Game
  • 11
  • 1
1
vote
0 answers

Why doesn't the Python socket receive packets?

My program doesn't receive any packets (on UDP, Windows 10), but when I sniff the data on Wireshark I can see that the data is indeed sent. I know that it doesn't have anything to do with my local network because when I switch to a hotspot it still…
Roey_MR
  • 23
  • 5
1
vote
1 answer

How Auth works with SocketIO?

I'm new to web sockets (specifically to socketIO interfaces, both client and server), and I wonder how basic JWT auth is usually implemented. How the headers are passed through. Should I add them to every socket listener or emit event? Or just once…
1
vote
0 answers

How to setup a Python socket on and IPv6 address?

I was making a quiz program for a school project with Python and in that, I was trying to implement some kind of server-client model so that my database of questions and scores stays on one central server. Anyways, I saw a few videos and read…
1
vote
0 answers

How can I get http response with 301 code using python sockets

I am sending a get request to any host using sockets tcp, but I keep on getting "301 Moved Permanently" from pages with https. I have tried to do it by changing the port from 80 to 443. I have tried with the ssl library as well. But keep getting 301…
1
vote
1 answer

Set timeout and reconnection in Python Server

I build that server in Python , I need to serve only 1 user each time import socket class MyServer: def __init__(self, port): self.port = port def run(self): sock = socket.socket(socket.AF_INET,…
vtable
  • 302
  • 2
  • 15
1
vote
1 answer

Python Sockets - Data is being sent way too fast

I'm using python sockets to send data across however whenever I'm sending data to the client, it seems to miss my data unless I'm debugging (which allows me to pause execution when needed). Server snippet: def send_file(client_socket: socket): …
Joy Singh
  • 415
  • 2
  • 11
1
vote
1 answer

Address already in use when restarting socket

I have the following Socket Server to run in a Raspberry. I can connect to it, send commands and it replies the command. Now I want that when I send the command RESET the Socket gets disconnected and the Raspberry returns to a Listening state,…
user2261062
1
vote
1 answer

Python Asynchronous FQDN Resolution

I have a list of 10k ips and I need to get their FQDN. Doing this synchronously takes ages, so I tried coding it asynchronously, but I don't see any difference in execution times. Synchronous method: def test_synch(): start_time = time.time() …
Sederfo
  • 177
  • 1
  • 11