2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "udpreplier.h"
23 // undeclared function
24 void UDPReplierStartThread(void *arg)
26 UDPReplier *m = (UDPReplier *)arg;
31 UDPReplier::UDPReplier()
38 UDPReplier::~UDPReplier()
43 int UDPReplier::stop()
45 if (!running) return 0;
48 pthread_cancel(runThread);
49 pthread_join(runThread, NULL);
56 if (running) return 1;
58 if (pthread_create(&runThread, NULL, (void*(*)(void*))UDPReplierStartThread, (void *)this) == -1) return 0;
59 Log::getInstance()->log("UDP", Log::DEBUG, "UDP replier started");
63 void UDPReplier::run2()
65 // I don't want signals
68 pthread_sigmask(SIG_BLOCK, &sigset, NULL);
73 retval = ds.waitforMessage(0);
74 if (retval == 1) continue;
76 if (!strcmp(ds.getData(), "VOMP CLIENT"))
77 ds.send(ds.getFromIPA(), 3024, "VOMP SERVER", 11);