I made more tests with my code and after reading Ramihyn's message i found this bug(?)
I declared a record for the header of each message something like:
Header = Record
ID: TGUID;
Function: Byte;
TTL:byte;
Hops:byte;
Datalength: Integer(???)
end;
in the last line i declared the data length as an Integer (it is 4 bytes) which is acceptable for the Gnutella Protocol but when i send a ping message with datalength value as zero the server got a response of 33 00 00 00h instead of 00 00 00 00h. So i declared Datalength as a DWORD (which is also 4 bytes) and the problem fixed. Maybe there are more bugs like this one...
Thak you for your help...