int main() { SocketHandler h; ListenSocket<DisplaySocket> l(h); StdoutLog log; h.RegStdLog(&log); if (l.Bind(9001)) { exit(-1); } h.Add(&l); h.Select(1,0); while (!quit) { h.Select(1,0); } }
int main() { SocketHandler h; StdoutLog log; h.RegStdLog(&log); ListenSocket<ServerSocket> l(h); l.SetIpv6(); if (l.Bind(40001,10)) { exit(-1); } h.Add(&l); h.Select(1,0); while (h.GetCount()) { h.Select(1,0); } }
int main(int argc,char *argv[]) { if (argc < 2) { printf("Usage: %s <command>\n",*argv); return -1; } SocketHandler h; StdoutLog log; h.RegStdLog(&log); ClientSocket cc(h,argv[1]); cc.SetIpv6(); cc.Open("localhost",40001); // Add after Open h.Add(&cc); h.Select(1,0); while (h.GetCount()) { h.Select(1,0); } }