Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import socket
- TCP_IP = '127.0.0.1'
- TCP_PORT = 6767
- BUFFER_SIZE = 1024
- MESSAGE = ("A"*4096)+("B"*4096)+("C"*4096);
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((TCP_IP, TCP_PORT))
- s.send(MESSAGE)
- received = "";
- while (len(received) < len(MESSAGE)):
- data = s.recv(BUFFER_SIZE)
- print "received data: %d bytes ending in ...%s" % (len(data), data[-10:])
- received += data
- s.close()
- sehe ~ Projects stackoverflow python ./test.py
- received data: 1024 bytes ending in ...AAAAAAAAAA
- received data: 1024 bytes ending in ...AAAAAAAAAA
- received data: 1024 bytes ending in ...AAAAAAAAAA
- received data: 1024 bytes ending in ...AAAAAAAAAA
- received data: 1024 bytes ending in ...BBBBBBBBBB
- received data: 1024 bytes ending in ...BBBBBBBBBB
- received data: 1024 bytes ending in ...BBBBBBBBBB
- received data: 1024 bytes ending in ...BBBBBBBBBB
- received data: 1024 bytes ending in ...CCCCCCCCCC
- received data: 1024 bytes ending in ...CCCCCCCCCC
- received data: 1024 bytes ending in ...CCCCCCCCCC
- received data: 1024 bytes ending in ...CCCCCCCCCC
Add Comment
Please, Sign In to add comment