本文整理汇总了C++中PacketsPattern::setSenderAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ PacketsPattern::setSenderAddress方法的具体用法?C++ PacketsPattern::setSenderAddress怎么用?C++ PacketsPattern::setSenderAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketsPattern
的用法示例。
在下文中一共展示了PacketsPattern::setSenderAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int result = 0;
bool send = false;
bool recv = false;
char c;
/* check args */
while (1) {
c = getopt(argc, argv, "rsR:S:");
if (c == -1) {
break;
}
switch (c) {
case 'r':
recv = true;
break;
case 's':
send = true;
break;
case 'R':
pattern.setReceiverAddress(new InetHostAddress(optarg));
break;
case 'S':
pattern.setSenderAddress(new InetHostAddress(optarg));
break;
default:
cerr << "Wrong Arguments, only -s and -r are accepted" << endl;
}
}
if (send || recv) {
if (send) {
cout << "Running as sender" << endl;
}
else {
cout << "Running as receiver" << endl;
}
}
else {
cerr << "No send or receive argument specificied" << endl;
exit(1);
}
// accept as parameter if must run as --send or --recv
#if 0
RecvPacketTransmissionTest *rx;
SendPacketTransmissionTest *tx;
// run several tests in parallel threads
if ( send ) {
tx = new SendPacketTransmissionTest();
tx->start();
tx->join();
} else if ( recv ) {
rx = new RecvPacketTransmissionTest();
rx->start();
rx->join();
}
//#endif
//#if 0
ZrtpRecvPacketTransmissionTest *zrx;
ZrtpSendPacketTransmissionTest *ztx;
if ( send ) {
ztx = new ZrtpSendPacketTransmissionTest();
ztx->start();
ztx->join();
} else if ( recv ) {
zrx = new ZrtpRecvPacketTransmissionTest();
zrx->start();
zrx->join();
}
#endif
ZrtpRecvPacketTransmissionTestCB *zrxcb;
ZrtpSendPacketTransmissionTestCB *ztxcb;
if ( send ) {
ztxcb = new ZrtpSendPacketTransmissionTestCB();
ztxcb->start();
ztxcb->join();
} else if ( recv ) {
zrxcb = new ZrtpRecvPacketTransmissionTestCB();
zrxcb->start();
zrxcb->join();
}
exit(result);
}