View Single Post
  #1 (permalink)  
Old May 8th, 2003
zomlak zomlak is offline
Novicius
 
Join Date: May 8th, 2003
Posts: 4
zomlak is flying high
Question No pong received!

Hi,

I am currently writing a simple gnutella client as my thesis. But I am
stucked at the moment. My question might not be of common interest. If so please state do you know any list or forum to ask for help.

Anyway,

I have used Gnutella protocol draft at rfc-gnutella.sourceforge.net. So far
I have achieved connecting to the network using GnuWebCaches. I receive a
200 OK messega from a connected client. So up to this point everything must
be fine. But then I send a ping message and wait for a pong. But nothing is
received. Only send returns 0.

My C code,

struct ping_header
{
char GUID[16];
char Payload_Type;
char TTL;
char Hops;
char Payload_Len[4];
};

struct ping_header *get_ping_header(void)
{
struct ping_header *p_head;

p_head = (struct ping_header *)malloc(sizeof(struct ping_header));
p_head = (struct ping_header *)malloc(sizeof(struct ping_header));

strcpy(p_head->GUID,"jhwerdkrodmwjydh");
p_head->Payload_Type = '0';
p_head->TTL = '2';
p_head->Hops = '0';
strcpy(p_head->Payload_Len,"0");

return p_head;
}
...
...
send(sockfd, get_ping_header(), sizeof(struct ping_header), 0);
memset(buf, '\0', 1024);
while (1)
{
i = recv(sockfd, buf, 1024, 0);
if(i>=0)
{
printf("\n<%d> bytes data received\n", i);
printf("\nPing is answered as %s\n", buf);
}
}


Kaan Coskun
Reply With Quote