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

ConnectionAbortedError: [Errno 53] Software caused connection abort

i am trying to establish connections for multiple sockets using multi-threading this is the code import socket as sc if __name__ == '__main__': #setup() ports = [10000, 10010, 10020, 10030] init_sockets() init_threads() def…
1
vote
0 answers

Python Socket programming with Multithreading

So , i learned the concepts of socket programming and multithreading today and quickly had an idea to implement it by creating a Messenger kind of app , where two connected clients can chat with each other. Server.py : import socket c = None…
1
vote
1 answer

Python socket timing out on other computer. TimeoutError: [WinError 10060]

I'm trying to connect a client to server through python sockets. Clients connect successfully on my computer, but people on other networks cannot connect. TimeoutError: [WinError 10060] on the client side after failing to connect. Here is the code…
Dubstep
  • 137
  • 1
  • 10
1
vote
0 answers

Sending Raw ethernet packet containing IPv4 and TCP SYN but not getting SYN/ACK packet in response packet

I am trying to send a ethernet packet containing an IPv4 packet and a TCP packet using Python raw socket. The SYN flag in the TCP packet is set to 1. The packet is addressed to the apache web server running on my local machine. My goal is to send a…
anbocode
  • 53
  • 6
1
vote
1 answer

Multithreaded server using Python Websockets library

I am trying to build a Server and Client using Python Websockets library. I am following the example given here: Python OCPP documentation. I want to edit this example such that for each new client(Charge Point), the server(Central System) runs on…
1
vote
2 answers

Why does this not connect me to my server?

I am trying to establish a connection to server.py but client.py outputs this error Traceback (most recent call last): File "C:\Users\Nathan\Desktop\Coding\Langs\Python\Projects\Chatting Program\Client.py", line 15, in
NaNdy
  • 99
  • 8
1
vote
1 answer

Sending png files over python sockets

I've set up a python client and server with socket in Python, that allows the server to send text to the client and I've been trying to extend it so that images can be sent to the client. Server code: import socket #setup and bind server…
andypaling1
  • 142
  • 12
1
vote
1 answer

OSError: [WinError 10013] error in Windows 10

To begin with, I know this has been asked and answered before but I can not seem to get it to work with the solutions provided in previous threads. (I am running windows 10 and Python 3.8.1) So I have not had this problem before, and I have been…
JakobVinkas
  • 1,003
  • 7
  • 23
1
vote
0 answers

Sending and receiving multiple objects in pygame with sockets and pickle

I'm making multiplayer game (2 hosts, local network) in pygame. I'm newbie in socket programming and can't handle problem with sending and receiving multiple data. I've got this pretty nice code from this: Python Online Game Tutorial - Sending…
alfa-beta
  • 43
  • 1
  • 8
1
vote
1 answer

Python Sockets: Question regarding Network Buffers when using send() and recv()

First, of, I've read around a fair amount of time including many threads on this site, however I still need some clarification on Sockets, TCP and Networking in Python, as I feel like I don't fully understand what's happening in my program. I'm…
Scholar
  • 463
  • 5
  • 19
1
vote
1 answer

How to know if a non-blocking socket is closed?

I'm trying to write my own TCP Non-Blocking Server to handle multiple long lasting socket connections rather than opening many threads to handle them. I've written my over-complicated, hard to use syntax but have the issue forms when I'm trying to…
SamHDev
  • 172
  • 1
  • 14
1
vote
1 answer

How to fix '[Errno 98] Address already in use' in Python

I'm using DreamHost as a hosting-provider for my server.py .If I run my code locally, the setsockopt function succesfully sets the parameter SOCKET_REUSEADDR to True and I can effectively reuse the port. But when I run server.py on the hosting, I…
Nikola Stoilov
  • 85
  • 1
  • 10
1
vote
0 answers

Sending and receiving encrypted and signed documents in a local client server scenario

I want to build a local cilen-server which can transfer a file which will be encrypted by RSA algo and signed and the receiver will decrypt that file and will verify the signature. I found many tutorials on how to build a client server scenario in…
1
vote
1 answer

Python socket only receives input once when using pygame

I am trying to send a message using sockets dependant on the state of my arrow keys, it seems that the first keypress works fine, and then the rest are irrelevant. Client code: import socket import pygame sender =…
1
vote
0 answers

python socket send returning 404

import socket mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock.connect(('www.py4inf.com', 80)) #mysock.send('GET http://www.py4inf.com/code/romeo.txt HTTP/1.0\n\n') mysock.send('GET http://www.py4inf.com/code/intro-short.txt…
magnolia04
  • 11
  • 2