+ timeouts = 1;
+
+ pkt_mkwrq(tx, file_remote, TFTP_BLKSIZE);
+
+ while (!g_interrupted) {
+ ackblock = -1;
+ op = pkt_num(rx);
+
+ if (!timeouts) {
+ if (op == ACK) {
+ ackblock = pkt_num(rx + 2);
+ } else if (op == OACK) {
+ ackblock = 0;
+ if ((val = pkt_optval(rx, "blksize"))) {
+ blksize = strtol(val, &end, 10);
+ if (*end != '\0' || blksize < 8 || blksize > TFTP_BLKSIZE) {
+ fprintf(stderr, "Error: invalid blksize in OACK: %s\n", val);
+ ret = -1;
+ goto cleanup;
+ }