-/***************************************************************************
- * 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
{
- string data;
- // wait till server is up
- sleep(1);
-
+ try
{
- socket_client_connection sc("./socket");
+ string data;
+ // wait till server is up
+ sleep(1);
- sc.write("ABC");
+ {
+ socket_client_connection sc("./socket");
- // wait half a sec
- sc.fill_buffer(500000);
- sc.get_packet(data);
+ sc.write("ABC");
+
+ // wait half a sec
+ sc.fill_buffer(500000);
+ sc.get_packet(data);
- // close the connection
+ // close the connection
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- string data;
- // wait till server is up
- sleep(1);
-
+ try
{
- socket_client_connection sc("./socket");
+ string data;
+ // wait till server is up
+ sleep(1);
- sc.write("ABC");
+ {
+ socket_client_connection sc("./socket");
- // wait half a sec
- sc.fill_buffer(500000);
- sc.get_packet(data);
+ sc.write("ABC");
+
+ // wait half a sec
+ sc.fill_buffer(500000);
+ sc.get_packet(data);
- // close the connection
+ // close the connection
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- string data;
- // wait till server is up
- sleep(1);
-
+ try
{
- socket_client_connection sc("./socket");
+ string data;
+ // wait till server is up
+ sleep(1);
- sc.write("ABC");
+ {
+ socket_client_connection sc("./socket");
- // wait half a sec
- sc.fill_buffer(500000);
- sc.get_packet(data);
+ sc.write("ABC");
- // close the connection
+ // wait half a sec
+ sc.fill_buffer(500000);
+ sc.get_packet(data);
+
+ // close the connection
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- string data;
- // wait till server is up
- sleep(1);
-
+ try
{
- socket_client_connection sc("./socket");
+ string data;
+ // wait till server is up
+ sleep(1);
- sc.write("1");
+ {
+ socket_client_connection sc("./socket");
- // wait half a sec
- sc.fill_buffer(500000);
- sc.get_packet(data);
+ sc.write("1");
+
+ // wait half a sec
+ sc.fill_buffer(500000);
+ sc.get_packet(data);
- sc.write("2");
+ sc.write("2");
- // close the connection
+ // close the connection
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
// don't call atexit and stuff
case 0:
// child
{
- socket_server ss("./socket");
-
- // max 3 sec
- for (int i=0; i < 3; i++)
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
- if(ss.get_packet(data,cid))
- break;
+ // max 3 sec
+ for (int i=0; i < 3; i++)
+ {
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
+ if(ss.get_packet(data,cid))
+ break;
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
+
// don't call atexit and stuff
_exit(0);
}
case 0:
// child
{
- socket_server ss("./socket");
-
- // max 3 sec
- for (int i=0; i < 3; i++)
+ try
{
- ss.fill_buffer(1000000);
+ socket_server ss("./socket");
- string data;
- unsigned int cid;
- if(ss.get_packet(data,cid))
- break;
+ // max 3 sec
+ for (int i=0; i < 3; i++)
+ {
+ ss.fill_buffer(1000000);
+
+ string data;
+ unsigned int cid;
+ if(ss.get_packet(data,cid))
+ break;
+ }
+ } catch(...)
+ {
+ std::cerr << "exception in child. ignoring\n";
}
+
// don't call atexit and stuff
_exit(0);
}