I'm learning a GTK Library. Now, i'm trying use a GSocketClient. I'm connecting to a telnet-server to read some data. This code
...
GInputStream* istream = g_io_stream_get_input_stream(G_IO_STREAM(scon));
GOutputStream* ostream = g_io_stream_get_output_stream(G_IO_STREAM(scon));
gsize dlen = 0;
gchar buffer[1024];
GError* error = NULL;
while (g_input_stream_read_all(istream, buffer, 1024, &dlen, NULL, &error)) {
for (int i = 0; i < dlen; i++) {
g_print("%c", buffer[i]);
}
if (dlen < 1024) {
break;
}
}
if (error != NULL) {
....
gets first block (1024 bytes), and then it blocks until connection breaks. What me do wrong? Thanks :)