-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxxx.txt
50 lines (42 loc) · 993 Bytes
/
xxx.txt
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
46
47
48
49
master create 13:06
#!/usr/bin/python
from socket import *
import ctypes
import struct
if len(sys.argv) != 3:
print("usage: ./hclt.py host port")
sys.exit(-1)
isize=88
idata = ctypes.create_string_buffer(isize)
for index in range(0, isize):
struct.pack_into('B', idata, index, index%255)
HOST = sys.argv[1]
PORT = int(sys.argv[2])
t_len=128
osize = 1024*1024
ADDR = (HOST, PORT)
tcpCliSock = socket(AF_INET, SOCK_STREAM)
tcpCliSock.connect(ADDR)
测试
cnt = 测试kkkkkkkkkkkk冲突;
测试2
while 1:
ssize = 0
while ssize != isize:
ssize += tcpCliSock.send(idata[ssize:])
print("sendsize:%d"%ssize)
rsize=0
while rsize != osize:
data = ''
data = tcpCliSock.recv(osize-rsize)
if 0 == len(data):
continue
rsize += len(data)
datastr = ' '.join( str(du) for du in struct.unpack_from('8B', data, 0) )
print("rsize:%d,%d,%s"%(rsize, len(datastr), datastr ) )
#time.sleep(10)
cnt = cnt+1
print('%d,%d'%(cnt,rsize))
测试3
tcpCliSock.close()
测试4