Skip to content

Instantly share code, notes, and snippets.

@marko-asplund
Last active September 12, 2015 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marko-asplund/aa7883dbbbc1a8be1580 to your computer and use it in GitHub Desktop.
Save marko-asplund/aa7883dbbbc1a8be1580 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import socket
sock = socket.socket()
sock.connect(("127.0.0.1", 26542))
ss = sock.makefile()
for i in range(1, 5000000):
ss.write("| %i:2\n" % i)
ss.flush()
l = ss.readline()
if len(l) < 1:
print "error: '%s'" % l
sys.exit(1)
print "ok %i, %i" % (i, len(l))
ss.close
sock.close
#!/bin/bash
for i in `seq 1 500000`; do
res=$(echo "| $i:2" | nc localhost 26542)
siz=$(echo "$res" | wc -c)
if [ "$siz" -lt "1" ]; then
echo "error response: $i, $siz, '$res'"
exit 1
else
echo "ok $i"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment