1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: testpip2.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sal.hxx"
37 #define INCL_DOSPROCESS
41 // eindeutiger Name f�r die Pipe
42 const char pszPipeName
[] = "TestPipe";
47 void fail( const char * pszText
, int retval
)
49 fprintf( stderr
, "TestPipe Client: %s", pszText
);
50 fprintf( stderr
, "TestPipe Client: test failed, ErrNo: %d.\n", retval
);
57 * Teste die Pipe-Implementation in osl
65 // gib dem Server die Chance, die Pipe zu ”ffnen
69 Pipe
= osl_createPipe( pszPipeName
, osl_Pipe_OPEN
, 0 );
72 fail( "unable to open pipe.\n",
73 osl_getLastPipeError(NULL
));
76 // empfange Daten vom Server
77 nChars
= osl_receivePipe( Pipe
, szBuffer
, 256 );
80 fail( "unable to read from pipe.\n",
81 osl_getLastPipeError( Pipe
) );
83 printf( "TestPipe Client: data received: %s.\n", szBuffer
);
85 // Sende die Daten wieder zur�ck.
86 nChars
= osl_sendPipe( Pipe
, szBuffer
, nChars
);
89 fail( "unable to write on pipe.\n",
90 osl_getLastPipeError( Pipe
) );
93 osl_destroyPipe( Pipe
);
95 printf( "TestPipe Client: test passed.\n" );