Python module which simplifies the task of writing network servers.
Questions tagged [socketserver]
385 questions
7
votes
3 answers
Client Socket Connections Being Denied By Server on Windows Host For Small Number (16 < x < 24) of Simulataneous Client Connection Attempts
We are experiencing a problem where our incoming client socket connections to our socket server are being denied when a relatively small number of nodes (16 to 24, but we will need to handle more in the future) are trying to connect…

Burton Samograd
- 3,652
- 19
- 21
7
votes
2 answers
is there any pool for ThreadingMixIn and ForkingMixIn for SocketServer?
I was trying to make an http proxy using BaseHttpServer which is based on SocketServer
which got 2 asynchronous Mixins (ThreadingMixIn and ForkingMixIn)
the problem with those two that they work on each request (allocate a new thread or fork a new…

Muayyad Alsadi
- 1,506
- 15
- 23
6
votes
3 answers
Adding SSL Support to SocketServer
I have a Server based on ThreadingTCPServer. Now Ii want to add SSL Support to that Server.
Without SSL it works fine but with SSLv3 I cant connect a Client to the Server, it always throws an exception: Error 111 Connection Refused. The error mens…

Pabi
- 891
- 3
- 12
- 18
6
votes
4 answers
Shutdown for socketserver based Python 3 server hangs
I am working on a "simple" server using a threaded SocketServer in Python 3.
I am going through a lot of trouble implementing shutdown for this. The code below I found on the internet and shutdown works initially but stops working after sending a…

moin moin
- 2,263
- 5
- 32
- 51
6
votes
3 answers
Looking to emulate the functionality of socat in Python
I need to send a string to a particular port on localhost using python.
I can achieve this by using socat on the command line like such:
cat | socat stdin tcp-connect:127.0.0.1:55559
I don't want to run the…

BlooMeth
- 101
- 1
- 8
6
votes
2 answers
Python SocketServer
How can I call shutdown() in a SocketServer after receiving a certain message "exit"? As I know, the call to serve_forever() will block the server.
Thanks!

carlosalbertomst
- 513
- 6
- 18
6
votes
1 answer
Shutting down gracefully from ThreadingTCPServer
I've created a simple test app (Python 2.6.1) that runs a ThreadingTCPServer, based on the example here. If the client sends a command "bye" I want to shut down the server and exit cleanly from the application. The exit part works OK, but when I…

Lynn
- 1,103
- 15
- 29
6
votes
1 answer
SocketServer rfile.read() very very slow
I am building an HTTPS proxy which can forward all SSL traffic. It is called a transparent tunneling. Anyway, I have a problem with Python's socketserver. When I called rfile.read(), it takes a very long time to return. Even I used select to make…

Kehan Wang
- 173
- 1
- 8
6
votes
0 answers
SocketServer Python with multiple requests
i'm coding a Python Server (with SocketServer) for my Raspberry Pi.
This server wait for incoming clients and activate any components like Relay and leds from that remote connection.
This is my first project so i'm having some trouble:
in my main i…

AeonDave
- 781
- 1
- 8
- 17
6
votes
2 answers
Only receiving one byte from socket
I coded a server program using python.
I'm trying to get a string but i got only a character!
How can I receive a string?
def handleclient(connection):
while True:
…

programmer
- 75
- 1
- 3
5
votes
1 answer
Is there a way for BaseRequestHandler classes to be stateful?
Short Question
Using my examples below, is there a Pythonic way to share my_object's actual instance with with the BaseRequestHandler class?
Background
By definition, the BaseRequestHandler class creates a new instance for each request. Because…

Adam Lewis
- 7,017
- 7
- 44
- 62
5
votes
1 answer
Python SocketServer.TCPServer request
I've been playing around with Python's SocketServer:
#!/usr/bin/python
import SocketServer
class EchoHandler(SocketServer.BaseRequestHandler):
def handle(self):
data=self.request.recv(1024)
self.request.send(data)
HOST, PORT =…

Adam Matan
- 128,757
- 147
- 397
- 562
5
votes
1 answer
Python SimpleHTTPServer hangs after several requests
I'm writing a simple integration test which consists of the following:
Starting a simple HTTP server which serves up a page to be tested
Starting various different browsers which load this page to confirm that everything works.
I know #2…

Elephantinae
- 51
- 3
5
votes
2 answers
SocketServer ThreadingMixIn purpose of server_thread
In the example of a asynchronous (threading) SocketServer http://docs.python.org/2/library/socketserver.html a server thread (called server_thread) is started, to start new threads for each request. Due to some problems catching KeyboardInterrupts,…

user135361
- 125
- 1
- 6
5
votes
2 answers
Shut down SocketServer on SIG*
I'm confused as to how to properly shut down a very simple server that I'm using.
I was thinking that this should be enough:
#!/usr/bin/python
import signal
import myhandler
import SocketServer
def terminate(signal, frame):
print "terminating…

Alois Mahdal
- 10,763
- 7
- 51
- 69