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
  #1 (permalink)  
Old March 20th, 2002
Novicius
 
Join Date: March 20th, 2002
Posts: 2
Gemini is flying high
Question Network Model

Hum, after reading the second part on How to Program a gnutella client , I must admit I did not really understand how I could implement an asynchronous server.
How in a more detailed manner does it work. In fact, I don't understand how we can hadle multi connection without a multithread. I guess it is because my knowledge is still too poor.

Could anyway light my bulb on that issue and explain to me how i could implement it.
Reply With Quote
  #2 (permalink)  
Old March 20th, 2002
Unregistered
Guest
 
Posts: n/a
Default

It's called select(). It's a standard system call or library function or whatever it is on all OSs.
It monitors a bunch of file descriptors and returns when one of them becomes readable and/or writable and/or an exception occured.
Reply With Quote
  #3 (permalink)  
Old March 22nd, 2002
Mutella Developer
 
Join Date: January 30th, 2002
Location: Germany
Posts: 87
maksik is flying high
Default

Check Mutella's source code (http://mutella.sourcefprge.net). Asyncroneous socket support is provided by MAsyncSocket class (asyncsocket.h, asyncsocket.cpp)

if you have some particular questions I may try to help

--Max
Reply With Quote
  #4 (permalink)  
Old April 1st, 2002
Novicius
 
Join Date: March 20th, 2002
Posts: 2
Gemini is flying high
Thumbs up Thanks

Thank you guys I think now i can make it work.
Cheers for helping me.
Reply With Quote
  #5 (permalink)  
Old May 27th, 2002
Apprentice
 
Join Date: May 27th, 2002
Posts: 8
loStHead is flying high
Default

Hi!

I understand how asynchronous sockets work. But what about funcions that cause a delay or block the program, like connect() ?
I used this kind of sockets on my Gnutella and Im having trouble with connect(), which blocks until it gets a response or a time out (that could be more than 2 minutes).

Should I create a new thread to handle this kind of functions or is there a way not to use threads at all?
Reply With Quote
  #6 (permalink)  
Old May 27th, 2002
Connoisseur
 
Join Date: August 9th, 2001
Location: Philadelphia, PA, USA
Posts: 358
cultiv8r is flying high
Default

loStHead,

I'm using synchronous sockets actually, which is one thread per connection. I simply create a new thread and pass the socket handle (of an incoming connection), or ask the thread to connect. All non blocking.

Asynchronous is event driven, and a bit harder to keep in sync, IMO. But that depends on programming experience.
Reply With Quote
  #7 (permalink)  
Old May 27th, 2002
Apprentice
 
Join Date: May 27th, 2002
Posts: 8
loStHead is flying high
Default

Right.
Ive been thinking about mixing asynchronous sockets and syncronous, or whatever, using poll() to watch for events on a main thread, while other thread handles incoming connections (blocks in an infinite listen), and many more threads handling outgoing connections. That is, when they connect (full handshaking) the thread exits and joins the main thread.

What I actually want is not to use threads at all, if possible, as Mutella (I guess) does.

Thats the only solution I could think about but Im sure anyone here can help me through this.
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
Need docs about Limewire Searching Model thongta Open Discussion topics 0 March 14th, 2006 04:30 PM
New filesharing model to outwit censors and improve reliability mcalwell General Gnutella Development Discussion 9 December 4th, 2003 02:07 PM
Object model Marwa General Gnutella Development Discussion 0 November 6th, 2003 04:36 AM
A viable advert free model/option gpenguin XoloX Feature Request 1 November 25th, 2002 11:03 AM
network connection erroe. re-configure network settings? mcdted Support: General 3 October 4th, 2001 01:12 AM


All times are GMT -7. The time now is 05:25 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.