Python module which simplifies the task of writing network servers.
Questions tagged [socketserver]
385 questions
5
votes
1 answer
Python 2 does not handle signals if TCPServer is running in another thread
While playing with standard library i've found a strange difference between python2 and python3. If i try to catch a signal in python2 while TCPServer is running in a different thread the signal does not get handled, but in python3 it does.
Here is…

Blin
- 698
- 9
- 18
4
votes
1 answer
Why does this socket connection only allow 1 send and receive?
Background
I have a simple socket server setup that I am trying to allow simultaneous connections to and echo back the data. The client side launches several threads each making its own connection to the server. This works fine for the…

Adam Lewis
- 7,017
- 7
- 44
- 62
4
votes
0 answers
Socket server crashing in multithreaded program
I have a standard socketserver that looks a bit like:
import time
import socketserver
import threading
import io
class Handler(socketserver.StreamRequestHandler):
def handle(self):
return cache.handle(self.rfile, self.wfile)
class…

FHTMitchell
- 11,793
- 2
- 35
- 47
4
votes
3 answers
TCP-Server over SSL using SocketServer.TCPServer
i want to add ssl-support to an existing TCP-server which is based on the SocketServer.TCPServer class.
So i overrode the default constructor of the TCPServer class and added the ssl.wrap_socket(...)-call:
class…

Biggie
- 7,037
- 10
- 33
- 42
4
votes
3 answers
In python, how to get a UDPServer to shutdown itself?
I've created a class for a server with the declaration:
class myServer(socketserver.BaseRequestHandler):
def handle(self):
pass
And started it with:
someServer = socketserver.UDPServer((HOST, PORT), myServer) …

shwartz
- 631
- 3
- 13
- 29
4
votes
1 answer
Python socket server failing
I'm trying to start a UDP server in python 3.
I copied the code from this example.
This is my exact code.
import socketserver
class MyUDPHandler(socketserver.BaseRequestHandler):
"""
This class works similar to the TCP handler class, except…

hamsolo474 - Reinstate Monica
- 659
- 1
- 13
- 22
4
votes
1 answer
Which Python library should I use? SocketServer or Asyncio?
I am going to create web server which could receive a lot of connections. These 10000 connected users will send to server numbers and server will return these squared numbers to users back.
10000 connections are too many and asynchronous approach is…

goodgrief
- 378
- 1
- 8
- 23
4
votes
0 answers
How to shutdown server with open client connection?
I have been looking for some time for a solution to terminate a socketserver.StreamRequestHandler spawned as a separate thread by the class ThreadingMixIn when the main tread terminates. The problem was that the socketserver thread, although being…

Blindfreddy
- 622
- 6
- 12
4
votes
0 answers
connecting to multiple ports using python socketserver
Ok, trying to port over some C++ code to python. For this specific case I need to set up a TCP/IP server to accept communication over multiple ports. In the old C++ code multiple instances of casyncsocket are created corresponding to each port.
I…

Jacobnotricky
- 41
- 4
4
votes
2 answers
Python SocketServer can't receive all data
I am trying to implenent SocketServer to receive file from mobile application:
Mobile application sends size of file.
Mobile application sends file.
Size of file is received correctly. In application all data is sent. However, SocketServer can't…

Tzoiker
- 1,354
- 1
- 14
- 23
4
votes
0 answers
python error: [Errno 32] Broken pipe in Socket.sendall()
I am writing a multi-threaded client/server program. It splits a large file into smaller files in its client side and sends the smaller files to the server concurrently.
The problem is that in every run, the server can only receive two of the…

Mahyar Hosseini
- 131
- 4
- 12
4
votes
2 answers
Python launch a process completely independent of the launching process
I'm using python 2.5.2 or 2.7 which is a HTTP server (BaseHTTPServer) that launches various tasks. One of the processes is a long running process. What I would like to be able to do is to launch this process then close my HTTP server and…

user3678436
- 41
- 2
4
votes
1 answer
python bottle can run two programs on the same address and port on WINDOWS
I just encountered a weird issue about bottle on windows.
When I tested the my bottle codes, I found that it could run multiple same programs on WINDOWS using same address and port. But when you try to start multiple same program on the Linux or Mac…

Colin Ji
- 803
- 7
- 15
4
votes
3 answers
Python socket recv from java client
I have a problem with a simple python tcp server (I'm using SocketServer class) that have to receive data from a java client.
Here the server side code:
class ServerRequestHandler(SocketServer.BaseRequestHandler):
[...]
def handle(self):
…

Codename47
- 295
- 4
- 17
4
votes
1 answer
python ftp server showing "150 File status okay. About to open data connection." and does nothing
I am trying to run an ftp server in python using pyftpdlib module. The problem occurring is that it shows a "150 File status okay. About to open data connection." and then just stays like that forever until the server time's out.
I log in through…

thecreator232
- 2,145
- 1
- 36
- 51