- response = g_string_sized_new(1024);
-
- len = recv(tcp->socket, buf, sizeof(buf), 0);
-
- if (len < 0) {
- sr_err("Receive error: %s", strerror(errno));
- g_string_free(response, TRUE);
- return SR_ERR;
- }
-
- response = g_string_append_len(response, buf + 4, len - 4);
-
- *scpi_response = response->str;
-
- sr_dbg("SCPI response received (length %d): '%.50s'",
- response->len, response->str);
-
- g_string_free(response, FALSE);