static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)

{

    TCPCharDriver *s = chr->opaque;

    if (s->connected) {

        return send_all(s->fd, buf, len);

    } else {

        /* (Re-)connect for unconnected writing */

        tcp_chr_connect(chr);

        return 0;

    }

}

static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)

{

    TCPCharDriver *s = chr->opaque;

    if (s->connected) {

        return send_all(s->fd, buf, len);

    } else {

        

        tcp_chr_connect(chr);

        return 0;

    }

}

static int FUNC_0(CharDriverState *VAR_0, const uint8_t *VAR_1, int VAR_2)

{

    TCPCharDriver *s = VAR_0->opaque;

    if (s->connected) {

        return send_all(s->fd, VAR_1, VAR_2);

    } else {

        

        tcp_chr_connect(VAR_0);

        return 0;

    }

}

static int FUNC_0(CharDriverState *VAR_0, const uint8_t *VAR_1, int VAR_2)
{ TCPCharDriver *s = VAR_0->opaque; if (s->connected) { return send_all(s->fd, VAR_1, VAR_2); } else { tcp_chr_connect(VAR_0); return 0; } }