Gnutella Forums  

Go Back   Gnutella Forums > Gnutella News and Gnutelliums Forums > General Gnutella Development Discussion
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Today's Posts

General Gnutella Development Discussion For general discussion about Gnutella development.


Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old April 30th, 2002
Gnutella Veteran
 
Join Date: March 24th, 2002
Location: Virginia
Posts: 101
tshdos is flying high
Default

Cerebro:

If you could post the code you are having problems with we can tell you how to fix it.

Here is an example though:

struct GHEADER
{
unsigned char MsgID[16];
unsigned char FuncID;
unsigned char TTL;
unsigned char Hops;
unsigned long PayloadLen;
};

// Assume hdr is a GHEADER struct that has been filled

// Method 1
// copy from struct to buffer
char buffer[23];
memcpy( buffer, (char*)&hdr, 23 );

// Method 2
// copy struct member by member to buffer
char buffer2[23];
memcpy( &buffer[0], hdr.MsgID, 16 );
memcpy( &buffer[16], hdr.FuncID, 1 );
memcpy( &buffer[17], hdr.TTL, 1 );
memcpy( &buffer[18], hdr.Hops, 1 );
memcpy( &buffer[19], hdr.PayloadLen, 4 );
Reply With Quote
  #12 (permalink)  
Old May 2nd, 2002
Disciple
 
Join Date: April 3rd, 2002
Posts: 10
Cerebro is flying high
Default

Thanks, but I think payload length must be int, because it must to be 4 bytes long.
Reply With Quote
  #13 (permalink)  
Old May 2nd, 2002
Gnutella Veteran
 
Join Date: March 24th, 2002
Location: Virginia
Posts: 101
tshdos is flying high
Default

On Win32 unsigned int and unsigned long are the same (4 bytes).
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Zip Header Geoff114 General Mac Support 1 November 30th, 2005 09:18 AM
zip header Unregistered Download/Upload Problems 2 June 25th, 2002 08:22 AM
Creating header struct Unregistered General Gnutella Development Discussion 3 April 4th, 2002 09:50 AM
help! zip header?? Unregistered Mac OSX 3 March 28th, 2002 07:10 PM
zip header Unregistered Mac OSX 2 March 18th, 2002 06:53 PM


All times are GMT -7. The time now is 03:31 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.