python Programming Glossary: socket.socket
How to properly send HTTP response with Python using socket library only? http://stackoverflow.com/questions/10114224/how-to-properly-send-http-response-with-python-using-socket-library-only # with connection queue of length 1 server_sock socket.socket socket.AF_INET socket.SOCK_STREAM socket.IPPROTO_TCP server_sock.bind..
Source interface with Python and urllib2 http://stackoverflow.com/questions/1150332/source-interface-with-python-and-urllib2 worse a code fragment such as import socket true_socket socket.socket def bound_socket a k sock true_socket a k sock.bind sourceIP.. a k sock true_socket a k sock.bind sourceIP 0 return sock socket.socket bound_socket Depending on your exact needs do you need all sockets.. DO need to bind in a certain way then each time restore socket.socket true_socket to get out of the way for future sockets yet to..
Python Interpreter blocks Multithreaded DNS requests? http://stackoverflow.com/questions/1212716/python-interpreter-blocks-multithreaded-dns-requests name def run self print Connecting... self._name try s socket.socket socket.AF_INET socket.SOCK_STREAM s.setblocking 0 s.connect..
How can I use a SOCKS 4/5 proxy with urllib2? http://stackoverflow.com/questions/2317849/how-can-i-use-a-socks-4-5-proxy-with-urllib2 socks.PROXY_TYPE_SOCKS5 127.0.0.1 8080 socket.socket socks.socksocket import urllib2 print urllib2.urlopen 'http..
Using urllib2 with SOCKS proxy http://stackoverflow.com/questions/2537726/using-urllib2-with-socks-proxy but it has to be used this way import socks import socket socket.socket socks.socksocket import urllib2 socks.setdefaultproxy socks.PROXY_TYPE_SOCKS5..
Python socket connection timeout http://stackoverflow.com/questions/3432102/python-socket-connection-timeout for the makefile . Here is the code I am using sock socket.socket socket.AF_INET socket.SOCK_STREAM sock.settimeout 10 sock.connect..
Python SocketServer: sending to multiple clients? http://stackoverflow.com/questions/3670127/python-socketserver-sending-to-multiple-clients self.name name self.hostIp ip self.hostPort port self.s socket.socket socket.AF_INET socket.SOCK_STREAM self.s.connect self.hostIp.. self.hostIp self.hostPort def reco self self.s socket.socket socket.AF_INET socket.SOCK_STREAM self.s.connect self.hostIp..
TypeError: 'module' object is not callable http://stackoverflow.com/questions/4534438/typeerror-module-object-is-not-callable is a module containing the class socket . You need to do socket.socket ... or from socket import socket import socket socket module.. socket module 'socket' from 'C Python27 lib socket.pyc' socket.socket class 'socket._socketobject' from socket import socket socket..
Problem with multi threaded Python app and socket connections http://stackoverflow.com/questions/4783735/problem-with-multi-threaded-python-app-and-socket-connections host self.port port self.status def run self self.sk socket.socket socket.AF_INET socket.SOCK_STREAM self.sk.settimeout 20 try..
Python urllib over TOR? http://stackoverflow.com/questions/5148589/python-urllib-over-tor socks.PROXY_TYPE_SOCKS4 127.0.0.1 9050 True socket.socket socks.socksocket print urllib2.urlopen http almien.co.uk m tools..
Python socket.accept nonblocking? http://stackoverflow.com/questions/5308080/python-socket-accept-nonblocking server example import select import socket server_socket socket.socket socket.AF_INET socket.SOCK_STREAM server_socket.setsockopt socket.SOL_SOCKET..
Multicast in Python http://stackoverflow.com/questions/603852/multicast-in-python import struct MCAST_GRP '224.1.1.1' MCAST_PORT 5007 sock socket.socket socket.AF_INET socket.SOCK_DGRAM socket.IPPROTO_UDP sock.setsockopt.. import socket MCAST_GRP '224.1.1.1' MCAST_PORT 5007 sock socket.socket socket.AF_INET socket.SOCK_DGRAM socket.IPPROTO_UDP sock.setsockopt..
python: how to send packets in multi thread and then the thread kill itself http://stackoverflow.com/questions/605013/python-how-to-send-packets-in-multi-thread-and-then-the-thread-kill-itself False test_time 60 #60 seconds of testing def send_data s socket.socket socket.AF_INET socket.SOCK_STREAM s.connect IP PORT count 1.. your other thread def send_data IP ... # other vars ... s socket.socket ..... # no killed checking # no time checking # just do your..
How can I check the data transfer on a network interface in python? http://stackoverflow.com/questions/7731411/how-can-i-check-the-data-transfer-on-a-network-interface-in-python import fcntl import struct def get_ip_address ifname s socket.socket socket.AF_INET socket.SOCK_DGRAM return socket.inet_ntoa fcntl.ioctl..
|