    # File alienconnection.rb, line 82
            def sendreceive(msg="", opts={})
                    timeout = opts.fetch(:timeout, 40)
                    wait_for_null = opts.fetch(:wait_for_null, true)
                    isRetrying = false

                    begin
                            if @connected
                                    send(msg)
                                    reply = receive(opts)
                                    if (reply.index("Connection Timeout.") == 0)
                                            # Received a "Connection Timeout" reply from the reader. Treat it like a "Broken pipe"...
                                            raise "Broken pipe"
                                    end

                                    return reply
                            else
                                    raise "Not connected to reader."
                            end
                    rescue
                            err = "Error in alienconnection:\nTried to send:\"#{msg}\"\nand got:\n\"" + $! +"\""

                            # Retry once
                            if (!isRetrying && $!.to_s == "Broken pipe")
                                    isRetrying = true
                                    openConnection()
                                    retry
                            else
                                    err = "Tried to send: \"#{msg}\"\nand got: \"#{$!}\""
                                    raise err
                            end
                    end
            end