Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import multiprocessing
- import time
- packet_1 = ping_YaRu
- packet_2 = ping_GoogleRu
- def fooPingInterface1():
- name = multiprocessing.current_process().name
- print name, 'Starting 1'
- for i in range(10):
- packet_1.Send(eth1)
- time.sleep(2)
- print name, 'Exiting'
- def fooPingInterface2():
- name = multiprocessing.current_process().name
- print name, 'Starting 2'
- for i in range(10):
- packet_2.Send(eth2)
- time.sleep(2)
- print name, 'Exiting'
- service1 = multiprocessing.Process(name = 'pingYandex', target = fooPingInterface1)
- service2 = multiprocessing.Process(name = 'pingGoogle', target = fooPingInterface2)
- interface_1 = multiprocessing.Process(target = fooPingInterface1)
- interface_2 = multiprocessing.Process(target = fooPingInterface2)
- interface_1.start()
- interface_2.start()
- service1.start()
- service2.start()
- service1.join()
- service2.join()
- def fooInterfaceSend1():
- name = multiprocessing.current_process().name
- print name, 'Starting 1'
- for i in xrange(5):
- Packet1.Send_(eth1)
- time.sleep(2)
- print name, 'Exiting'
- def fooInterfaceSend2():
- name = multiprocessing.current_process().name
- print name, 'Starting 2'
- for i in xrange(5):
- Packet2.Send_(eth2)
- time.sleep(2)
- print name, 'Exiting'
- service1 = multiprocessing.Process(name = 'Interface1', target = fooInterfaceSend1)
- service2 = multiprocessing.Process(name = 'Interface2', target = fooInterfaceSend2)
- service1.start()
- service2.start()
- service1.join()
- service2.join()
- import multiprocessing
- import time
- packet_1 = ping_YaRu
- packet_2 = ping_GoogleRu
- def fooInterfaceSend(value, packet, interface, rest):
- name = multiprocessing.current_process().name
- print name, 'Starting 1'
- for i in xrange(value):
- packet.Send(interface)
- time.sleep(rest)
- print name, 'Exiting'
- service1 = multiprocessing.Process(name = 'Interface1', target = fooInterfaceSend, args(10, packet_1, eth1, 2))
- service2 = multiprocessing.Process(name = 'Interface2', target = fooInterfaceSend, args(10, packet_2, eth2, 2))
- service1.start()
- service2.start()
- service1.join()
- service2.join()
- import multiprocessing
- import time
- packet_1 = ping_YaRu
- packet_2 = ping_GoogleRu
- def fooInterfaceSend(value, packet, interface, rest):
- name = multiprocessing.current_process().name
- print name, 'Starting 1'
- for i in xrange(value):
- packet.Send(interface)
- time.sleep(rest)
- print name, 'Exiting'
- service1 = multiprocessing.Process(name = 'Interface1', target = fooInterfaceSend, args(10, packet_1, eth1, 2))
- service2 = multiprocessing.Process(name = 'Interface2', target = fooInterfaceSend, args(10, packet_2, eth2, 2))
- service1.start()
- service2.start()
- service1.join()
- service2.join()
Add Comment
Please, Sign In to add comment