In linux, normally, it is impossible to "bind()" to the same TCP port twice. If you try to bind to the same port from second proces unix processes you'll see:
socket.error: [Errno 98] Address already in use
#!/usr/bin/env python | |
"""Simple HTTP Server With Upload. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
""" |
#!/usr/bin/env python | |
__author__ = 'Kevin Warrick' | |
__email__ = 'kwarrick@uga.edu' | |
import cPickle | |
from functools import wraps | |
def redis_lru(capacity=5000, slice=slice(None)): | |
""" | |
Simple Redis-based LRU cache decorator *. |
from __future__ import absolute_import | |
import signal | |
import gevent | |
import gevent.pool | |
from rq import Worker | |
from rq.timeouts import BaseDeathPenalty, JobTimeoutException | |
from rq.worker import StopRequested, green, blue | |
from rq.exceptions import DequeueTimeout |
package main | |
import ( | |
"flag" | |
"io" | |
"log" | |
"net" | |
"net/http" | |
"strings" | |
) |
#!/usr/bin/env python | |
import argparse | |
import redis | |
def connect_redis(conn_dict): | |
conn = redis.StrictRedis(host=conn_dict['host'], | |
port=conn_dict['port'], | |
db=conn_dict['db']) | |
return conn |
from concurrent.futures import ThreadPoolExecutor | |
from threading import BoundedSemaphore | |
class BoundedExecutor: | |
"""BoundedExecutor behaves as a ThreadPoolExecutor which will block on | |
calls to submit() once the limit given as "bound" work items are queued for | |
execution. | |
:param bound: Integer - the maximum number of items in the work queue |