-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy paththreadTest.py
More file actions
45 lines (43 loc) · 919 Bytes
/
threadTest.py
File metadata and controls
45 lines (43 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
######################################################################
# Multiple Switch Test
# Authors:
# Michael Kranch
#
# Python 3.3.2
#
# Description:
#
#
#
######################################################################
import socket
import sys
import dpkt
import binascii
import bitarray
import time
import ofprotocol
import threading
import MichaelFakeSwitch
if __name__ == '__main__':
"""
Start our thread test
"""
n = 0
while n < 10:
host = '127.0.0.1'
port = 6633
s=socket.socket()
s.connect((host,port))
thread1 = MichaelFakeSwitch.fakeSwitch()
thread1.setConnection(s)
thread1.answer_initial_config_request()
thread1.setOption(0)
thread1.start()
thread2 = MichaelFakeSwitch.fakeSwitch()
thread2.setConnection(s)
thread2.setOption(2)
thread2.start()
print("Starting Thread " + str(n))
n = n + 1
print("Done Loop")