~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/prototest/drizzle_flood

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
#
 
3
# Drizzle Client & Protocol Library
 
4
 
5
# Copyright (C) 2008-2010 Eric Day (eday@oddments.org)
 
6
# All rights reserved.
 
7
 
8
# Use and distribution licensed under the BSD license.  See
 
9
# the COPYING.BSD file in the root source directory for full text.
 
10
#
 
11
'''
 
12
Send an infinite amount of data to a MySQL server.
 
13
'''
 
14
 
 
15
import optparse
 
16
import sys
 
17
import socket
 
18
 
 
19
parser = optparse.OptionParser(add_help_option=False)
 
20
 
 
21
parser.add_option("--help", action="help", help="Print out help details")
 
22
parser.add_option("-h", "--host", dest="host", default="localhost",
 
23
                  help="Host or IP to test", metavar="HOST")
 
24
parser.add_option("-p", "--port", dest="port", default=3306,
 
25
                  help="Port to test", metavar="PORT")
 
26
 
 
27
(options, args) = parser.parse_args()
 
28
 
 
29
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
30
s.connect((options.host, int(options.port)))
 
31
print 'Connected to %s:%s' % (options.host, options.port)
 
32
 
 
33
server_header = s.recv(1024)
 
34
print 'Server Header:'
 
35
print list(server_header)
 
36
 
 
37
print
 
38
print 'Each . represents 16MB of data:'
 
39
 
 
40
# Max packet size plus sequence number '1'.
 
41
packet = '\xFF\xFF\xFF\x01'
 
42
data = 'x' * 8192
 
43
 
 
44
# Keep sending max size packets, causes infinite loop in my_net_skip_rest.
 
45
while True:
 
46
  s.send(packet)
 
47
 
 
48
  # Send 16777215 bytes.
 
49
  for x in range(0, 2047):
 
50
    s.send(data)
 
51
  s.send(data[1:])
 
52
 
 
53
  sys.stdout.write('.')
 
54
  sys.stdout.flush()