MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / main

Function main

util/nettest.cpp:173–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171
172
173int main(int argc, char **argv)
174{
175 int server = 0; char *serverName = NULL;
176 Socket *clientSocket = NULL;
177 char *buf = NULL; int i, j, size;
178 bool ipv6 = false, old = false;
179 Timer timer;
180 #if defined(sun) || defined(linux)
181 int interval = 2;
182 #endif
183
184 try
185 {
186 if(argc < 2) usage(argv);
187
188 if(!stricmp(argv[1], "-client"))
189 {
190 if(argc < 3) usage(argv);
191 server = 0; serverName = argv[2];
192 if(argc > 3) for(i = 3; i < argc; i++)
193 {
194 if(!stricmp(argv[i], "-h") || !strcmp(argv[i], "-?")) usage(argv);
195 else if(!stricmp(argv[i], "-old"))
196 {
197 printf("Using old protocol\n");
198 old = true;
199 }
200 else if(!stricmp(argv[i], "-time") && i < argc - 1)
201 {
202 if(sscanf(argv[++i], "%lf", &benchTime) < 1 || benchTime <= 0.0)
203 usage(argv);
204 }
205 else usage(argv);
206 }
207 }
208 else if(!stricmp(argv[1], "-server"))
209 {
210 server = 1;
211 if(argc > 2) for(i = 2; i < argc; i++)
212 {
213 if(!stricmp(argv[i], "-h") || !strcmp(argv[i], "-?")) usage(argv);
214 else if(!stricmp(argv[i], "-ipv6"))
215 {
216 ipv6 = true;
217 printf("Using IPv6 sockets ...\n");
218 }
219 else usage(argv);
220 }
221 }
222 else if(!stricmp(argv[1], "-findport"))
223 {
224 Socket socket(false);
225 printf("%d\n", socket.findPort());
226 socket.close();
227 exit(0);
228 }
229 #if defined(sun) || defined(linux)
230 else if(!stricmp(argv[1], "-bench"))

Callers

nothing calls this directly

Calls 15

benchmarkFunction · 0.85
LittleEndianFunction · 0.85
findPortMethod · 0.80
acceptMethod · 0.80
remoteNameMethod · 0.80
elapsedMethod · 0.80
whatMethod · 0.80
usageFunction · 0.70
initBufFunction · 0.70
cmpBufFunction · 0.70
closeMethod · 0.45
listenMethod · 0.45

Tested by

no test coverage detected