# File lib/network/packetio.rb, line 83
  def write(msg)
    if !msg.nil? && !msg.empty?
      @outbuffer << [msg.length].pack("N") << msg
    end
    n = @sock.send(@outbuffer, 0)
    # save unsent data for next call
    @outbuffer.slice!(0...n)
    @outbuffer.size == 0
  rescue Exception
    @outbuffer = ""  # Does it really matter?
    raise
  end