>From the post I gather that you are looking for a solution under Linux.
I don't know much linux, but under Windows you could patch the IAT
(import address table) of the running process temporarly to redirect
calls to the socket winsock api to a stup function, which simply fails.
If you are interes
Another solution is using a deliberately misconfigured proxy:
import socket
socket.setdefaulttimeout(1)
import urllib
proxies = {'http': 'http://www.example.com:3128'}
url = 'http://www.google.com/'
opener = urllib.FancyURLopener(proxies)
f = opener.open(url)
print f.read()
>From this code I get
Nice!!
Since that works, this also works (any socket operations appear to
raise an IOError):
import socket
socket.setdefaulttimeout(0)
Thanks!
-Adam
--
Adam Monsen
http://adammonsen.com/
--
http://mail.python.org/mailman/listinfo/python-list
How about this:
import timeoutsocket
timeoutsocket.setDefaultSocketTimeout(0)
This will make all sockets in your Python app fail.
https://svn.plone.org/svn/collective/CMFSquidTool/trunk/timeoutsocket.py
--
http://mail.python.org/mailman/listinfo/python-list
I know very little about socket programming and even less about
sockey.py... any idea what behavior would have to be modified?
Further complicating matters (for me), it appears some of the socket
programming code is in C, and my C skills are lacking.
--
Adam Monsen
http://adammonsen.com/
--
ht
Adam Monsen wrote:
> It would be helpful to be able to temporarily disable AF_INET socket
> connections (I don't care about IPv6 for now).
Maybe put an socket.py with mockup funktions in your path before the
real socket.py. Then you can alter teh behaviour of all necessary functions.
Diez
--
ht
It would be helpful to be able to temporarily disable AF_INET socket
connections (I don't care about IPv6 for now).
What I'd like to do is create an environment for a Python script that
appears like the network interface is down, so any remote socket stuff
should fail (like an HTTP GET request to