Files
harbour-core/contrib/hbmisc/tests/udpds.prg
vszakats 9687850865 2013-03-16 02:10 UTC+0100 Viktor Szakats (harbour syenar.net)
* (all files)
    * stripped svn header
    * minor cleanups
    ; use following command to find out the history of files:
       git log
       git log --follow
       git blame
       git annotate
2013-03-16 02:11:42 +01:00

41 lines
795 B
Plaintext

/*
* This module demonstrates a simple UDP Discovery Server
*/
#require "hbmisc"
PROCEDURE Main( cParam )
LOCAL h
IF ! hb_mtvm()
? "This sample should be compiled using MultiThread"
RETURN
ENDIF
IF cParam == NIL
? "udpdstst {c|s|cs}"
? "Parameter:"
? " s - run as a server"
? " c - run as a client"
RETURN
ENDIF
IF "S" $ Upper( cParam )
IF ! Empty( h := hb_udpds_Start( 39999, "UDPDSDemo", NetName() + " " + hb_TSToStr( hb_DateTime() ) ) )
hb_idleSleep( 0.1 )
ENDIF
ENDIF
IF "C" $ Upper( cParam )
? hb_ValToExp( hb_udpds_Find( 39999, "UDPDSDemo" ) )
ENDIF
IF "S" $ Upper( cParam )
? "Press any key to stop server"
Inkey( 0 )
hb_udpds_Stop( h )
ENDIF
RETURN