【发布时间】:2012-09-03 09:20:11
【问题描述】:
这是我目前所拥有的
socklen_t cli_size;
struct sockaddr cli;
int in_sock;
/* event from TCP server socket, new connection */
cli_size = sizeof(cli);
try {
if ((in_sock = ::accept(handle,&cli, &cli_size)) < 0) {
throw in_sock;
return NULL;
}
}
catch(int ex) {
cout << "Exception Nr. " << ex << endl;
}
来自手册页:
出错时返回-1,并正确设置errno。
问题:我还是不明白errno在哪里?我需要了解异常
【问题讨论】:
标签: c++ linux sockets error-handling throw