head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.40; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.58; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.04; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.22.01; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# socktest.cxx

    00001 #include <simgear/compiler.h>
    00002
    00003 #include <unistd.h>
    00004 #include STL_IOSTREAM
    00005
    00006 #include "sg_socket.hxx"
    00007 #include "lowlevel.hxx"
    00008
    00009 #if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
    00010 SG_USING_STD(cout);
    00011 SG_USING_STD(endl);
    00012 #endif
    00013
    00014 static const int sgEndianTest = 1;
    00015 #define sgIsLittleEndian (*((char *) &sgEndianTest ) != 0)
    00016 #define sgIsBigEndian    (*((char *) &sgEndianTest ) == 0)
    00017
    00018 int main() {
    00019
    00020     if ( sgIsLittleEndian ) {
    00021        cout << "this machine is little endian\n";
    00022     }
    00023
    00024     if ( sgIsBigEndian ) {
    00025        cout << "this machine is big endian\n";
    00026     }
    00027
    00028     cout << "short = " << sizeof(unsigned short) << endl;
    00029     cout << "int = " << sizeof(unsigned int) << endl;
    00030     cout << "long long = " << sizeof(long long) << endl;
    00031
    00032     SGSocket s( "", "5500", "tcp" );
    00033
    00034     if ( !s.open( SG_IO_BI ) ) {
    00035         cout << "error can't open socket\n";
    00036     }
    00037
    00038     char buf[256];
    00039
    00040     while ( true ) {
    00041         if ( s.readline( buf, 256 ) > 0 ) {
    00042             cout << "result = " << buf;
    00043         }
    00044 #ifdef __MINGW32__
    00045         Sleep(100);
    00046 #else
    00047         sleep(1);
    00048 #endif
    00049     }
    00050 }

@ 1.3 log @Oops, try again. @ text @d59 1 a59 1