@@ -1,6 +1,5 | |||
|
1 | 1 | import socket No newline at end of file |
|
2 | 2 | import string |
|
No newline at end of file | ||
|
3 | #import time No newline at end of file | |
|
4 | 3 | No newline at end of file |
|
5 | 4 | def int2bin(n): No newline at end of file |
|
6 | 5 | n_hex = "%x" %n No newline at end of file |
@@ -1,5 +1,20 | |||
|
1 | 1 | import socket No newline at end of file |
|
2 | 2 | import time No newline at end of file |
|
3 | ||
|
No newline at end of file | ||
|
4 | def int2str(n): | |
|
No newline at end of file | ||
|
5 | str_n = str(n) | |
|
No newline at end of file | ||
|
6 | l_n = len(str_n) | |
|
No newline at end of file | ||
|
7 | if l_n == 1: | |
|
No newline at end of file | ||
|
8 | str_n = "00000" + str_n | |
|
No newline at end of file | ||
|
9 | elif l_n == 2: | |
|
No newline at end of file | ||
|
10 | str_n = "0000" + str_n | |
|
No newline at end of file | ||
|
11 | elif l_n == 3: | |
|
No newline at end of file | ||
|
12 | str_n = "000" + str_n | |
|
No newline at end of file | ||
|
13 | elif l_n == 4: | |
|
No newline at end of file | ||
|
14 | str_n = "00" + str_n | |
|
No newline at end of file | ||
|
15 | elif l_n == 5: | |
|
No newline at end of file | ||
|
16 | str_n = "0" + str_n | |
|
No newline at end of file | ||
|
17 | return str_n No newline at end of file | |
|
3 | 18 | No newline at end of file |
|
4 | 19 | host = "192.168.1.117" No newline at end of file |
|
5 | 20 | s = socket.socket() No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now