title: Game Maker networking, sending too much data
body: <p>I am working on a game with Game Maker and am having a little trouble with networking :(  My server is coded in python with the help of Twisted Framework.</p>
  
  <p>Anywho, as an example, when I click a button in my Game Maker game to send my login information to the server, it appears to send it numerous times with a single click of the mouse, which isn't right.  Here is my send script code...</p>
  
  <pre><code>var t_buffer = buffer_create(256, buffer_grow, 1)
  buffer_seek( t_buffer, buffer_seek_start, 0)
  buffer_write( t_buffer , buffer_string, chr(argument0) + string(argument1) )
  network_send_packet(obj_Server.client, t_buffer, buffer_tell(t_buffer))
  buffer_delete(t_buffer)
  </code></pre>
  
  <p>My server side, for now, I just print out what data was sent, and it prints five lines of the same thing.  Here is my python code...</p>
  
  <pre><code># Sends received data to the protocol handler
  def dataReceived(self, data):
      self.protocolHandler(data)
  
  # Parses data sent from the client
  def protocolHandler(self, data):
      # Split our data
      #values = data.split("\x01")
      #eventTokens = values.pop(0)
      #eventToken1, eventToken2 = eventTokens
      print "Data Received:: " + str(data) + ": First Character: " + data[0]
  </code></pre>
  
  <p>For explanation sake, the tokens just help me identify what i need to do in game, for example, if I receive \x01\x03 I know it's a login packet, and there should be login data attached.  If I get \x02\x03 I know it's something else like my clients player has died.</p>
  
  <p>How should I be handling the sending of data so that it isn't sending numerous packets?</p>