/* UDPSear.c: demo12 for UDP Search Work with MiniOS7 utility Compiler: BC++ 3.1, Turbo C++ 1.01(3.01) Compile mode: Large Project: UDPSear.c ..\lib\7188el.Lib ..\lib\tcpip32.lib ..\lib\FW_nnnnn.LIB Hordware: I-7188EX [Nov 04, 2008] by Liam [Aug,02,2011] by Nicholas */ #include #include #include "..\lib\7188e.h" #include "..\lib\Tcpip32.h" #include "..\lib\MFW.h" #define BUFSIZE 1460 // read/write buffer size char *GetModuleName(void) // User's program must support this function for UDP search { return "I-7188EX-FW"; // You can define any string you like } char *GetAliasName(void) // User's program must support this function for UDP search { return "test1" ; } void XS_UserInit(int argc,char *argv[]) { extern int bAcceptBroadcast; extern unsigned long ACKDELAY; //extern long MAXTXTOUT; void UserLoop(void); char version[20]; InitLib(); bAcceptBroadcast=0; ACKDELAY=200; /* XS_GetVersion(version); Print("[X-Server library]: version=%s ",version); XS_GetLibDate(version); Print("date=%s\r\n",version); GetTcpipLibDate(version); Print("Tcpip library version:%X, Library Date is %s\r\n",GetTcpipLibVer(),version); */ XS_AddSystemLoopFun(UserLoop); /* Add UDP search function */ bAcceptBroadcast=1; // allow to receive the UDP broadcast XS_AddUdpSocket(&XS_UdpSearch); /* if you using sockets, add the following two lines*/ XS_AddSystemLoopFun(XS_SocketLoopFun); XS_StartSocket(); //MAXTXTOUT=6000UL; } void XS_UserEnd(void) { XS_StopSocket(); DisableWDT(); } void UserLoop(void) { int key; if(Kbhit()) { switch((key=Getch())) { case 27: QuitMain=1; break; default: break; } } } void main(int argc,char *argv[]) { XS_main(argc,argv); // call the XS library main function. }