📄 coop.cc,v
字号:
head 1.2;access;symbols;locks rbraud:1.2; strict;comment @// @;1.2date 2002.08.06.17.09.09; author rbraud; state Exp;branches;next 1.1;1.1date 2002.07.02.19.29.08; author rbraud; state Exp;branches;next ;desc@@1.2log@added the sigint handler, and talker setup@text@/* * File: coop.cc * Author: Suman Banerjee <suman@@cs.umd.edu> * Date: 15th February, 2002 * Terms: GPL * * NICE Application Layer Multicast */#include "o_timeout.h"#include "coop-agent.h"#include "talker_utils.h"#include "timer.h"#include <stdlib.h>#include <unistd.h>int NUM_PACKETS = 3000;float PACKET_GAP = 1.0;int START_DELAY = 20;void SIGINTHandler(int SignalType) { printf("Disconnecting from talker...\n"); exit(disconnect_talker());}int main(int argc, char ** argv) { struct sigaction handler; if (argc != 6) { printf("usage: %s < agent id > < port num > < bse hostname > < talker hostname > < talker port >\n", argv[0]); exit(-1); } handler.sa_handler = SIGINTHandler; if(sigfillset(&handler.sa_mask) < 0) { printf("Couldn't fill signal set\n"); return -1; } handler.sa_flags = 0; if(sigaction(SIGINT, &handler, 0) < 0) { printf("Couldn't set signal action\n"); return -1; } coopAgent mycoop; mycoop.init(atoi(argv[1]),0,atoi(argv[2]), argv[3]); mycoop.add_listening_fd(mycoop.udp_sock, NULL); setup_talker(argv[4], atoi(argv[5])); initTimeout(); mycoop.start(); printf("my coop started\n"); return 0; }@1.1log@Initial revision@text@d12 1d21 5d28 15a42 3 if ((argc !=4 ) && (argc != 8)) { printf("usage: %s < agent id > < port num > < bse host name > <\"src\" <num-packets> <gap> <start-delay> {optional}> \n",argv[0]); exit(0);d46 2a48 7 if (argc == 8) if (strcmp(argv[4], "src") == 0) { NUM_PACKETS = atoi(argv[5]); PACKET_GAP = atof(argv[6]); START_DELAY = atoi(argv[7]); mycoop.init_data_traffic_params(DIST_CONSTANT,NUM_PACKETS, PACKET_GAP, START_DELAY); }@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -