- From: Thomas Dreibholz <dreibh AT exp-math.uni-essen.de>
 
- To: "Marjan Bozinovski" <marjanb AT cpk.auc.dk>,	rsplib-discussion AT sctp.de
 
- Cc: Michael Tüxen <Michael.Tuexen AT icn.siemens.de>,	Michael Tüxen <Michael.Tuexen AT micmac.franken.de>
 
- Subject: Re: [RSPlib-Discusssion] fail-over problems
 
- Date: Mon Oct 21 12:52:00 2002
 
- List-id: RSPlib Discussions <rsplib-discussion.sctp.de>
 
- Organization: University of Essen, Institute for Experimental Mathematics
 
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
The cause of your problems have been found: Your program creates new 
processes using fork() in line 518. This cannot work with the socket API and 
it will never work. But you can use threads (see manual page of 
pthread_create) to provide a similar functionality.
The sctplib's functionality is provided within an event loop. The user has to 
continously call sctp_eventLoop() for the sctplib to be able to handle events 
like timers and incoming data. This makes debugging easier but programming of 
applications more complicated since you cannot simply do e.g. blocking 
reads or writes. Using kernel-based protocols, the protocol's background 
execution is hidden in the kernel. The socket API for the sctplib provides 
this functionality by a second thread that runs the sctplib's event loop in 
background. It uses mutexes to prevent both threads from causing 
interferences.
Using fork(), you simply copy the whole process. This also includes kernel 
file handles but not the socket API ones. Furthermore, all threads are 
duplicated, including the SCTP instance and mutexes. Therefore, this totally 
wrecks the socket API and sctplib management structures.
Since you are programming in C++, you can simply use my class Thread and the 
classes Synchronizable and Condition to implement multiple threads. Just 
inherit the class Thread and implement the method go(). Then, calling start() 
starts your new thread.
Best regards
- -- 
=======================================================================
 Dipl.-Inform. Thomas Dreibholz
 University of Essen,                            Room ES210
 Inst. for Experimental Mathematics              Ellernstraße 29
 Computer Networking Technology Group            D-45326 Essen/Germany
- -----------------------------------------------------------------------
 E-Mail:     
dreibh AT exp-math.uni-essen.de
 Homepage:   
http://www.exp-math.uni-essen.de/~dreibh
=======================================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see 
http://www.gnupg.org
iD8DBQE9s9sH32BbsHYPLWURAp6CAKDId/6qgFX7GFIvCTU9SkvE4fViMACdHuy5
SWQYNLdhTzGEToDf08dYYWE=
=4f+V
-----END PGP SIGNATURE-----
Archive powered by MHonArc 2.6.19+.