[gnet] Problem with GConnHttp



Hi everyone, I'm having some problems with GConnHttp for retrieving
all the data from a BitTorrent tracker. See the test program attached:
on most URL's, everything works fine and ends with a "completed"
notification; however, on certain sites it ends with "partial" and
does not retrieve the rest of the data.

./test www.google.com
works

./test "http://inferno.demonoid.com:3393/announce?info_hash=%BAN%A2W%91%8E%27%AF%7BN%923%15Xwv%CF7%A9%2C&peer_id=xTO0001x79044C15266F&port=6552&uploaded=0&downloaded=0&left=38739990&compact=1&event=started&numwant=30";
doesn't download everything, even though e.g. wget will retrieve it all.

Samuel Cormier-Iijima
#define GNET_EXPERIMENTAL

#include <gnet.h>

void
connected (GConnHttp *conn, GConnHttpEvent *event, gpointer data)
{
	switch (event->type) {
	case GNET_CONN_HTTP_DATA_PARTIAL:
		g_print ("partial\n");
		break;
	case GNET_CONN_HTTP_DATA_COMPLETE:
		g_print ("complete\n");
		break;
	case GNET_CONN_HTTP_RESOLVED:
		g_print ("resolved\n");
		break;
	case GNET_CONN_HTTP_CONNECTED:
		g_print ("connected\n");
		break;
	case GNET_CONN_HTTP_REDIRECT:
		g_print ("redirect\n");
		break;
	case GNET_CONN_HTTP_ERROR:
		g_print ("error\n");
		break;
	case GNET_CONN_HTTP_RESPONSE:
		g_print ("response\n");
		break;

	}

	return;
}

int
main (int argc, char *argv[])
{
	GConnHttp *conn;

	if (argc < 2)
		return 1;

	gnet_init ();

	conn = gnet_conn_http_new ();

	gnet_conn_http_set_uri_unescaped (conn, argv[1]);

	if (!gnet_conn_http_run (conn, connected, NULL))
		return 1;

	return 0;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]