Gnutella Forums  

Go Back   Gnutella Forums > Current Gnutella Client Forums > GnucDNA Based Clients > Gnucleus (Windows)
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Today's Posts

Gnucleus (Windows) For assistance for users with the Gnucleus program. Important links: Updated Gnucleus 2.2.0.0 Installer! and also Updated Connection Caches for Gnucleus!


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old February 20th, 2002
Moak's Avatar
Guest
 
Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak is flying high
Default Question on Gnucleus socket Close()

Hi swabby,

what is the purpose of your extra code in the sockets Close() method? Would it make a difference if I leave it away?
I mean this code snippet:
Code:
	// Clean receive buffer
	int iRet = 0;
	byte pBuf[4096];	
	while( (iRet = Receive(pBuf, 4096)) > 0 );

	// Close socket
	AsyncSelect(0);
Mutella (a kind of Unix reincarnation) does something different:
Code:
	AsyncSelect(FD_CLOSE);
	ShutDown(2);
Thx for some helping words, Moak
Reply With Quote
  #2 (permalink)  
Old February 20th, 2002
Moak's Avatar
Guest
 
Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak is flying high
Default

It seems you try a friendly shutdown, while Max from Mutella loves it the hard way to disconnect.

About friendly disconnect, shouldn't it be:

while(m_bDataSending && !m_bForceDisconnect); //wait until send buffer cleared
AsyncSelect(0);
Shutdown(1); //perform a friendly TCP shutdowm
while(Receive(m_aBuffer, sizeof(m_aBuffer))>0 && !m_bForceDisconnect);
CAsyncSocket::Close()

Greets, Moak

PS: Okay this doesn't work too. Since there is no possibility to get interrupted by a class method that sets m_bForceDisconnect. Perhaps it's a conceptional design weakness in CAsyncSocket?

Last edited by Moak; February 20th, 2002 at 05:38 AM.
Reply With Quote
  #3 (permalink)  
Old February 20th, 2002
Gnucleus Developer
 
Join Date: May 29th, 2001
Location: Boston, MA
Posts: 110
swabby is flying high
Default

There are about 10 socket derived classes in gnucleus for a variety of specific purposes. I try to keep the Close() method accross them the same.

You're referencing some old code there though, I'm pretty active with updates usually so I suggest going to gnucleus.net, reading the instructions for getting the latest source and checking it out.

The current code first locks the thread the socket is being closed in and once it is locked does this:

AsyncSelect(0);
ShutDown(1);

I took the clean receive buffer stuff out of there because it was pointless.

There is a huge bug with misdirectedn messages in CAsyncSocket derived classes, but it is fixed by putting AsyncSelect(0); in the deconstructor. It took me sooo long to find that simple fix.
Reply With Quote
  #4 (permalink)  
Old February 21st, 2002
Moak's Avatar
Guest
 
Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak is flying high
Default

I used guntelladev.com for browsing various Gnutella source code. About your current source, it's on CVS, well perhaps not the best way to attract new coders... but maybe you have enough.
Reply With Quote
  #5 (permalink)  
Old February 21st, 2002
Gnucleus Developer
 
Join Date: May 29th, 2001
Location: Boston, MA
Posts: 110
swabby is flying high
Default

You can browse the very latest source with your web browser at http://cvs.sourceforge.net/cgi-bin/v...us/GnucleusR2/

or at gnucleus.net there are detailed instructions for users with no experience with cvs, to get up and running with wincvs and how to get the latest gnucleus source anonymously.

We always need more developers.
Reply With Quote
  #6 (permalink)  
Old February 21st, 2002
Moak's Avatar
Guest
 
Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak is flying high
Default

Wow, you did a lot since I looked into your code last time!

Now I wonder that so "less" ppl use your client since the functionality and the source looks nice. Honestly I have to say, I bumped into Gnucleus by accident. I personaly like/use Mutella and so found a way to Gnucleus. Will run/compile Gnucleus when I find more time... haven't done yet. :-)

Just some suggestions: Perhaps you should add this link for browsing code to your home page and a tgz for download too. I know IT IS a minor solution compared to checking out the source, but guess how many coders use CVS today... and will be held back? Speaking about me, I will have a look on the code, when I find more time... at the moment I'm busy with some own stuff and PEERanha. The first step into Mutella/Gnucleus was hard, -on gnutelladev.com- I found no concept design or class descriptions and the code had (like Mutella) very few comments to get a overview. Not ment bad in any way, just thinking loud.

Hope you get more coders, Moak

Last edited by Moak; February 24th, 2002 at 04:00 PM.
Reply With Quote
  #7 (permalink)  
Old February 21st, 2002
Unregistered
Guest
 
Posts: n/a
Default

Quote:
Originally posted by Moak
-on gnutelladev.com- I found no concept design or class descriptions and the code had (like Mutella) very few comments to get a overview.
And that is why C++ sucks so bad, you guys won't take the time to document your classes, so how the hell do you expect anyone else but you to use them? Or is that the point? Job security?

Progremmers will never document properly, it's just part of the nature of this type of nural network, so C++ will always suck.

How silly is it to write a commercial app depending on other "classes" that may or may not crash / cause problems beacause you didn't write the code yourself and learn how it works, or the documentation sucks so you call it wrong?

Then the language, what a joke. Some guy decided he wanted his own little language when he came up with this C++ stuff, so he re-wrote the way you speak C. "classes" "destructors" what a joke.

And the :: and string += stuff is way too stupid, now you have these want-to-be Jr. programmers who don't understand how to handle a real string in memory, and how it is all really memory mapped and when you add more like strcat(str1,str2) it takes processor time.

go program basic and leave the real programming to professionals.
Reply With Quote
  #8 (permalink)  
Old February 21st, 2002
Gnucleus Developer
 
Join Date: May 29th, 2001
Location: Boston, MA
Posts: 110
swabby is flying high
Default

Gnucleus is pretty decently commented, anywhere things get complicated there are definently comments to help people out. When ever I write code I think to myself, 'if someone reads this, will they understand it?' If you do have trouble with the source email me, I'll explain it all to you, whatever it is.

Go to http://www.gnucleus.net , on the left hand side there are a set of links to the developer section. I suggest you (Moak) first take a look at the 'Structure' link, this will help you or anyone else understand the basic class structure of gnuclues.

If you open the workspace in MS dev, you will be able to use some of visual studio's advanced source browsing features to get a better feal of the code and how classes are organized.
Reply With Quote
  #9 (permalink)  
Old February 21st, 2002
Moak's Avatar
Guest
 
Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak is flying high
Default

Hmm.... do you believe from looking on the "structure" picture a new developer will understand what's goin on? For example will he/she understand that CGnuControl is the listening server socket, CnuSock.cpp an accepted client socket which will be turned into CGnuNode or into some other CAsyncSocket derived class after evaluating initiating protocol handshake? Everything without one single line of comment describing what the purpose of each class is, how they work together or what important methods and data structures are supposed to do? Without an overall design guide describing underlying concepts, class purpose, class usage... I feel there might be a lack of documentation. Perhaps ppl need to write a own Gnutella client to understand what's going on. Just thinking loud, perhaps I'm a bad coder...

> If you do have trouble with the source email me, I'll explain it all to you, whatever it is.

thx a lot
Reply With Quote
  #10 (permalink)  
Old March 1st, 2002
Moak's Avatar
Guest
 
Join Date: September 7th, 2001
Location: Europe
Posts: 816
Moak is flying high
Default Gnucleus Structure

Your structure picture is not correct IMHO:

- There is no class CGnuDocument, I think you mean CGnucleusDoc.

- The links between 'Doc' and 'View' are wrong. CFrameMain is in the root node, CGnucleusDoc must be linked to CFrameMain not CGnucleus. Also CGnuControl must be linked to CFrameMain not CGnucleusDoc/CGnuDocument.

Hope it helps, Moak

PS: You should rename CGnuControl::CleanDeadSocks to CleanDirtySocks(), kidding, couldn't resist.

Last edited by Moak; March 1st, 2002 at 08:18 AM.
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
Question on Gnucleus sockets, STL Kaom Gnucleus (Windows) 2 August 20th, 2002 12:08 PM
Question about Socket error Unregistered Support: General 2 June 25th, 2002 03:21 PM
gnucleus.exe will now close Unregistered Gnucleus (Windows) 0 May 29th, 2002 12:26 AM
Should LimeWire close when I close the terminal window? Unregistered General Linux Support 4 September 19th, 2001 07:37 PM
socket error? Unregistered Gnotella (Windows) 1 July 15th, 2001 08:31 PM


All times are GMT -7. The time now is 03:22 AM.


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.