我正在尝试为Curl的HTTP对象(http://erdani.com/d/phobos-prerelease/std_net_curl.html#.Curl.onSocketOption)实现ng-show="cheked(data.id)"
委托。
onSocketOption
有时似乎有效,有时我得到int onSocketOption(curl_socket_t socketfd,
CurlSockType type) {
import std.socket:Socket, SocketOptionLevel, SocketOption, Linger, AddressFamily;
Socket sock = new Socket(socketfd, AddressFamily.INET);
Linger lingerOpt;
lingerOpt.on = 0;
lingerOpt.time = 0;
sock.setOption(SocketOptionLevel.SOCKET,
SocketOption.LINGER,
lingerOpt);
return 0;
};
有没有其他方法可以使用" curl_socket_t"?它的别名为std.socket.SocketOSException@/tmp/ldc.build/ldc/runtime/phobos/std/socket.d(3175): Unable to set socket option: Bad file descriptor
,而后者应该只是一个普通的套接字fd(在linux上运行)
请注意,HTTP没有回调,所以我有一个std.net.curl的分支,它将该接口添加到"协议" mixin in curl.d:
socket_t