Hi,
how do u read correctly from a ustream socket?
This works but writing to stdout is not what I want.
static void client_read_cb(struct ustream *s, int bytes)
{
char *buf;
int len;
buf = ustream_get_read_buf(s, &len);
fwrite(buf, len, 1, stdout);
fflush(stdout);
ustream_consume(s, len);
}
Why does this not work?
static void client_read_cb(struct ustream *s, int bytes)
{
char *buf;
int len;
char tmp_buffer[100];
memcpy(tmp_buffer, buf, len);
printf("Received: %s\n", tmp_buffer);
ustream_consume(s, len);
}