|
Register | FAQ | The Twelve Commandments | Members List | Calendar | Arcade | Find the Best VPN | Today's Posts | Search |
General Gnutella Development Discussion For general discussion about Gnutella development. |
| LinkBack | Thread Tools | Display Modes |
| |||
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. |
| |||
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 |
| |||
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? |
| |||
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. |
| |||
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. |
| |
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 |