MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/multicast/main.cpp:141–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141int main(int argc, char* argv[]) {
142 acl::string multicast_addr, local_iface = "0.0.0.0";
143 int ch, nsenders = 1, nreaders = 0, port = 8089, count = 10000;
144 acl::atomic_long write_counter, read_counter;
145 bool echo = false, loopback = false;
146
147 while ((ch = getopt(argc, argv, "hm:l:p:n:w:r:EO")) > 0) {
148 switch (ch) {
149 case 'h':
150 usage(argv[0]);
151 return 0;
152 case 'w':
153 nsenders= atoi(optarg);
154 break;
155 case 'r':
156 nreaders = atoi(optarg);
157 break;
158 case 'm':
159 multicast_addr = optarg;
160 break;
161 case 'l':
162 local_iface = optarg;
163 break;
164 case 'p':
165 port = atoi(optarg);
166 break;
167 case 'n':
168 count = atoi(optarg);
169 break;
170 case 'E':
171 echo = true;
172 break;
173 case 'O':
174 loopback = true;
175 break;
176 default:
177 break;
178 }
179 }
180
181 if (multicast_addr.empty()) {
182 printf("multicast_addr empty!\r\n");
183 usage(argv[0]);
184 return 0;
185 }
186
187 acl::log::stdout_open(true);
188
189 std::vector<acl::thread*> senders, readers;
190
191 struct timeval begin;
192 gettimeofday(&begin, NULL);
193
194 for (int i = 0; i < nsenders; i++) {
195 sender_thread* thread = new sender_thread(count, write_counter);
196 thread->set_multicast_loopback(loopback);
197
198 if (!thread->open(multicast_addr, local_iface, port)) {

Callers

nothing calls this directly

Calls 13

beginMethod · 0.80
usageFunction · 0.70
getoptFunction · 0.50
gettimeofdayFunction · 0.50
stamp_subFunction · 0.50
emptyMethod · 0.45
openMethod · 0.45
startMethod · 0.45
push_backMethod · 0.45
endMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…