Questions tagged [socketserver]

Python module which simplifies the task of writing network servers.

385 questions
2
votes
1 answer

Shutting down python TCPServer by custom handler

I'm trying to shutdown a TCPServer from the SocketServer module through a GET request by the client, emitted when the window is closed, however the following code fails to initiate the shutdown: def show_webgl(data): import SocketServer …
sonium
  • 918
  • 1
  • 11
  • 25
2
votes
2 answers

Python: How to set a timeout on receiving data in SocketServer.TCPServer

I've read quite a few things and this still escapes me. I know how to do it when using raw sockets. The following works just fine, times out after 1 second if no data is received: sock = socket.socket(socket.AF_INET,…
Normadize
  • 1,156
  • 12
  • 22
2
votes
1 answer

Understanding TCP listen backlog

I was going to get some insight into the impact of changing TCP connection queue size. So I wrote a simple server/client pair to test it. The server instantiates the ForkingTCPServer in the python module SocketServer. To test the impact of pending…
2
votes
0 answers

When should I set the allow_reuse_address property in a SocketServer subclass?

I've the following subclass of SocketServer.TCPServer: class MP3Server (SocketServer.TCPServer): def __init__(self, server_address, RequestHandlerClass, SoundObj, DocRoot): self.allow_reuse_address = True …
Zagorax
  • 11,440
  • 8
  • 44
  • 56
2
votes
2 answers

socket server - getting a connected user's ip

I have just started to make a simple socket "chat" server where users connect to my server through telnet. I was wondering how I could get the connected users IP address so that It would print out that users message like so: IP address:…
DeanMWake
  • 893
  • 3
  • 19
  • 38
2
votes
1 answer

Java Client/Server Bi-Directional Sockets not working

I am writing a Java client/server application which will communicate 2 maps back and forth between each program. The client populates the initial map and sends it to the server. The server receives the map as expected and displays the data. …
2
votes
1 answer

Simple TCP Server in python

Newbie here. I am trying to create a simple TCP server is process requests using SocketServer. Somehow, the handle() method is not getting called. Version: 2.4.3 on Linux Here is the relevant code: #!/usr/bin/python -u import socket; import…
Ravi Kulkarni
  • 43
  • 1
  • 1
  • 6
2
votes
1 answer

Capture destination IP in TCP Python SocketServer

I have a Python script that is running on a Linux server that has a dozen IP addresses associated with it. I implemented a TCPSServer from Python's socketserver library and had it listen on all network interfaces. Several devices will be connecting…
Terry
  • 989
  • 8
  • 29
2
votes
1 answer

SocketServer ThreadingTCPServer & Asyncore Dispatcher

I want to add a timeout to individual connections within my request handler for a server using the SocketServer module. Let me start by saying this is the first time I'm attempting to do network programming using Python. I've sub-classed…
Ælex
  • 14,432
  • 20
  • 88
  • 129
2
votes
1 answer

How to identify which port is being listened in Python's SocketServer?

I have a small application that spawns a number of ports (300 to be exact). When it spawns a socket it uses: # when someone connects via socketlistener, do some stuff class SocketListener((SocketServer.BaseRequestHandler)): print "Do some…
2
votes
2 answers

Socket programming - Java server, C (or other) client - server gives "invalid stream header"

Server (java): public static void main(String[] args) { //single threaded for now try { //very magic # ServerSocket service = new ServerSocket(33000); while(true) { debug("Begin waiting for connection"); //this spins …
djechlin
  • 59,258
  • 35
  • 162
  • 290
1
vote
0 answers

Trying to force my app to close and the TcpListener to stop listening - stackOverflow

My dual-role app (in its role as "Server" running on another machine) fails to actually shut down when I close it (it is still in the "Processes" list in Task Manager after I close the app). I don't know if it is staying "live" because its…
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
1
vote
1 answer

python socketserver occasionally stops sending (and receiving?) messages

I've been experiencing a problem with a socketserver I wrote where the socketserver will seem to stop sending and receiving data on one of the ports it uses (while the other port continues to handle data just fine). Interestingly, after waiting a…
tedtoy
  • 168
  • 2
  • 12
1
vote
1 answer

Python multiprocessing communication with SocketServer instances

I have a set of processes, let's call them A, B, and C, that need to communicate with one another. A needs to communicate with B and C; B needs to communicate with A and C; and C needs to communicate with A and B. A, B, and C could be located on…
agarrett
  • 423
  • 1
  • 5
  • 15
1
vote
2 answers

Adobe Flex/Air ServerSocket: remote connection from Socket class

I have to ask this because Flash/Flex is driving me nuts. I am using the ServerSocket class in an Air environment on the desktop to setup a server that listens for mobile clients (Air for mobile). I tested this in debug mode (Flash Builder) and…
dergestalt
  • 41
  • 5