Sockets: Simulate multiple clients in python using one machine/NIC -
i trying write python program spawn multiple clients speak 1 server on network. question need simulate different ip addresses each client?
i using mac osx lion right python 2.6.
i have developed server side can accept multiple sockets. want avoid having machine each client. tips/hints newbie appreciated.
even though old question, still appears in google...
as mentioned, take ip connection received , assigns next available port... standard socket.. end bunch of connections same ip varying ports.
personally me easier create client script generate amount of clients need (i'm using 1000+ clients single python script)..
once have clients generated, have script generate ip each of clients.. if handling connection objects correctly.. can refer client want..
so in end, have clients coming same machine or on network have variable random/generated ip address can test with.. takes few lines use generated ip address reference socket object.
if wanting work ip specific allow connection particular subnet.. generate fake ip address @ time of connection , use if real one.
if wanting have multiple clients, no need generate ip address @ different port.
Comments
Post a Comment