Python module which simplifies the task of writing network servers.
Questions tagged [socketserver]
385 questions
3
votes
2 answers
Why can not I access my SockectServer in local area network while I can access in my own computer?
I build a socket server with python's SocketServer module:
import SocketServer
class MyTCPHandler(SocketServer.BaseRequestHandler):
def handle(self):
# self.request is the TCP socket connected to the client
self.data =…

roger
- 9,063
- 20
- 72
- 119
3
votes
2 answers
SocketServer bind multiple server
I'm trying to bind multiple servers with python's SocketServer module:
import SocketServer
from SocketServer import BaseRequestHandler
class HTTPSERVER(BaseRequestHandler):
def handle(self):
rec = self.request.recv(1024)
if…

n00bz0r
- 87
- 9
3
votes
2 answers
OSError [Errno 99] - python
i want to execute the following simple server code:
import socket
s = socket.socket() # Create a socket object
host = socket.gethostname() # Get local machine name
port = 22331 # Reserve a port
s.bind((host, port)) #…

Maria
- 85
- 1
- 1
- 8
3
votes
2 answers
Python SocketServer - Get own IP
I'm creating a simple TCP server with Python3's socketserver module. I want to get the IP of the server that the server is serving on.
I noticed that there is a server_address attribute in socketserver (rather, BaseServer), but that returns…

defect
- 488
- 5
- 16
3
votes
2 answers
Python "instance has no attribute" error when extending SocketServer.TCPServer
I am trying to overwrite the serve_forever method of the SocketServer.TCPServer class. However i am getting a AttributeError: MyServer instance has no attribute '_MyServer__is_shut_down' error.
__is_shut_down is implemented in the…

greole
- 4,523
- 5
- 29
- 49
3
votes
2 answers
Broadcasting socket server in python
I am building a multiplayer game, so once the server started i want to broadcast server name continuously so that client can know that there are some server is running. I don't want to give IP address and port number to connect to server. can…

Hemanth S R
- 1,115
- 2
- 16
- 27
3
votes
1 answer
SocketServer no modules are getting import
I want to create a SocketServer on my mac.
However it seems to be some problem with the packages. When I try this sampling code found here it raises attributeerror.
import SocketServer
class MyTCPHandler(SocketServer.BaseRequestHandler):
"""
…

Diolor
- 13,181
- 30
- 111
- 179
3
votes
2 answers
python change max limit recv buffer in UDPServer
I use UDPServer based on BaseServer to receive frag UDP packets .
But some packets are larger than 8192 bytes(@handle method, print len(data)), and I can't use them correctly.
My original code:
class MyUDPHandler(SocketServer.BaseRequestHandler):
…

user1778354
- 323
- 2
- 14
3
votes
2 answers
How can you disable the output of socketserver in Python?
I have socketserver set up to run some unittests, and it's outputting its log to the console.
Is there a way to disable this?
Here's roughly the code I'm running:
class TestServer(SocketServer.TCPServer):
allow_reuse_address = True
class…

mlissner
- 17,359
- 18
- 106
- 169
3
votes
5 answers
python socketserver timeout
I'm implementing a simple server which should print a message if nothing is received for 3 seconds.
Handler
class SingleTCPHandler(SocketServer.StreamRequestHandler):
def handle(self):
while True:
message =…

TheMeaningfulEngineer
- 15,679
- 27
- 85
- 143
3
votes
1 answer
SimpleHTTPServer and SocketServer
I have created a 'handler' python script as follows:
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "Serving at port:",…

BloonsTowerDefence
- 1,184
- 2
- 18
- 43
3
votes
1 answer
How to send data to a different request from the current request handler? (Python SocketServer with ThreadingMixIn)
I'm writing a multiplayer game server and client in Python, using the built-in SocketServer's TCPServer and ThreadingMixIn because it seems easier than manually managing the socket and threading modules. (I'd like to stick with the built-in modules…

Remy
- 401
- 2
- 19
3
votes
0 answers
Implementing HTML5 Websocket server side using Java to send message to Browser?
Hi I have Implemented the WebSocket Frame reading from this thread How can I send and receive WebSocket messages on the server side?, really thanks.
I successful implemented the handshaking.
I succeeded on receiving message and reading the frame…

Haribabu Pasupathy
- 31
- 2
- 7
3
votes
1 answer
socket.error: [Errno 111] Connection refused
I am trying to get a prototype ready and am having trouble getting a connection. I'm using OpenSSL for both the client and the server.
#!/usr/bin/env python
import SocketServer
import json
from OpenSSL import SSL
import os
import…

Lunchbox
- 2,136
- 7
- 29
- 40
3
votes
2 answers
Can't reuse socket in SocketServer.TCPServer
I've got a problem with SocketServer.TCPServer. I'm running a server in a thread. Watching a directory tree with Watchdog. When "on_any_event" runs I need to take down the server and start it again. Unfortunately I can't get SocketServer.TCPServer…

vascop
- 4,972
- 4
- 37
- 50