Created
August 22, 2014 16:14
-
-
Save mattjbarlow/0e9b0deeb3c4bf6082e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import socket | |
import datetime | |
import random | |
TCP_IP = '127.0.0.1' | |
TCP_PORT = 2003 | |
tstamp = int(time.mktime(datetime.datetime.utcnow().timetuple())) | |
tstamp = datetime.datetime.utcnow() | |
for i in range(1, 10000): | |
tstamp = tstamp - datetime.timedelta(seconds=10) | |
s = socket.socket() | |
s.connect((TCP_IP, TCP_PORT)) | |
message = "dummydata.datetime.value {} {}\n".format( int(random.random() * 10000),\ | |
int(time.mktime(tstamp.timetuple())) ) | |
print message | |
s.sendall(message) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment