我正在学习如何使用 Apple 的安全传输框架为我的网络实现 TLS,这有点令人困惑。我相信我应该只是将我的套接字 fds 转换为 SSLConnectionRefs,但是当我这样做时会收到警告Cast to 'SSLConnectionRef' (aka 'const void *') from smaller integer type 'int'
。
int sockfd = socket(...);
...
SSLContextRef sslContext = SSLCreateContext(...);
// This line gives the warning
SSLSetConnection(sslContext, (SSLConnectionRef)sockfd);
我不会在这里丢失任何信息,因为void *
大于int
,对吗?所以这应该是安全的。我只是担心编译器警告。感谢您的任何建议。