-/***************************************************************************
- * Copyright (C) 2004 by Intra2net AG *
- * info@intra2net.com *
- * *
- ***************************************************************************/
+/*
+Copyright (C) 2004 by Intra2net AG
+The software in this package is distributed under the GNU General
+Public License version 2 (with a special exception described below).
+
+A copy of GNU General Public License (GPL) is included in this distribution,
+in the file COPYING.GPL.
+
+As a special exception, if other files instantiate templates or use macros
+or inline functions from this file, or you compile this file and link it
+with other works to produce a work based on this file, this file
+does not by itself cause the resulting work to be covered
+by the GNU General Public License.
+
+However the source code for this file must still be made available
+in accordance with section (3) of the GNU General Public License.
+
+This exception does not invalidate any other reasons why a work based
+on this file might be covered by the GNU General Public License.
+*/
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
case 0:
// child
{
- // wait till server is up
- sleep(1);
- socket_client_connection sc("./socket");
- sc.write("hello");
+ try
+ {
+ // wait till server is up
+ sleep(1);
+ socket_client_connection sc("./socket");
+ sc.write("hello");
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
- ss.set_logging(&cerr,debug);
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
+ ss.set_logging(&cerr,debug);
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
- if (data=="QUIT")
- break;
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
- if (data=="ABC")
- con->write("DEF");
- else
- con->write("xyz");
+ if (data=="QUIT")
+ break;
+
+ if (data=="ABC")
+ con->write("DEF");
+ else
+ con->write("xyz");
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
- ss.set_logging(&cerr,debug);
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
+ ss.set_logging(&cerr,debug);
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
- if (data=="QUIT")
- break;
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
- con->write(string().insert(0,100*1024,'y'));
+ if (data=="QUIT")
+ break;
+
+ con->write(string().insert(0,100*1024,'y'));
+ }
}
+ std::cerr << "child: OVER" << std::endl;
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
- std::cerr << "child: OVER" << std::endl;
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- // wait till server is up
- sleep(1);
- socket_client_connection sc(6666);
- sc.write("hello");
+ try
+ {
+ // wait till server is up
+ sleep(1);
+ socket_client_connection sc(6666);
+ sc.write("hello");
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
+ }
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss(6666);
- ss.set_logging(&cerr,debug);
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss(6666);
+ ss.set_logging(&cerr,debug);
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
+
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
- if (data=="QUIT")
- break;
+ if (data=="QUIT")
+ break;
- if (data=="ABC")
- con->write("DEF");
- else
- con->write("xyz");
+ if (data=="ABC")
+ con->write("DEF");
+ else
+ con->write("xyz");
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
_exit(0);
case 0:
// child
{
- socket_server ss(6666);
- ss.set_logging(&cerr,debug);
-
- time_t t0 = time(NULL);
-
- // max 10 sec
- while (time(NULL) < t0 + 10 )
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss(6666);
+ ss.set_logging(&cerr,debug);
- string data;
- unsigned int cid;
+ time_t t0 = time(NULL);
- if(ss.get_packet(data,cid))
+ // max 10 sec
+ while (time(NULL) < t0 + 10 )
{
- server_connection* con=ss.get_connection(cid);
+ ss.fill_buffer(1000000);
- socket_handler* alias= dynamic_cast< socket_handler* >(con);
+ string data;
+ unsigned int cid;
- if (data=="QUIT")
- break;
+ if(ss.get_packet(data,cid))
+ {
+ server_connection* con=ss.get_connection(cid);
- alias->set_write_block_size( 4093 );
- con->write(string().insert(0,2048*1024,'y'));
+ socket_handler* alias= dynamic_cast< socket_handler* >(con);
+
+ if (data=="QUIT")
+ break;
+
+ alias->set_write_block_size( 4093 );
+ con->write(string().insert(0,2048*1024,'y'));
+ }
}
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
_exit(0);