LPSTR CUDP::GetMac()
{
IPX_ADDRESS_DATA adapter_data;
adapter_data.adapternum = 0;
int optlen = sizeof(IPX_ADDRESS_DATA);
if(SOCKET_ERROR==getsockopt(m_sock,NSPROTO_IPX,IPX_ADDRESS,(char*)&adapter_data,&optlen))
{
return NULL;
}
memcpy(mac,adapter_data.nodenum,6);
return mac;
}
这个是干什么的?特别是getsockopt()和他的参数是什么意思??谁能帮我改成另外一种和这个功能一样的程序呀??谢谢了!
{
IPX_ADDRESS_DATA adapter_data;
adapter_data.adapternum = 0;
int optlen = sizeof(IPX_ADDRESS_DATA);
if(SOCKET_ERROR==getsockopt(m_sock,NSPROTO_IPX,IPX_ADDRESS,(char*)&adapter_data,&optlen))
{
return NULL;
}
memcpy(mac,adapter_data.nodenum,6);
return mac;
}
这个是干什么的?特别是getsockopt()和他的参数是什么意思??谁能帮我改成另外一种和这个功能一样的程序呀??谢谢了!
SOCKET s,
int level,
int optname,
char* optval,
int* optlen
);Parameters
s
[in] Descriptor identifying a socket.
level
[in] Level at which the option is defined; the supported levels include SOL_SOCKET and IPPROTO_TCP. See Windows Sockets 2 Protocol-Specific Annex for more information on protocol-specific levels.
optname
[in] Socket option for which the value is to be retrieved.
optval
[out] Pointer to the buffer in which the value for the requested option is to be returned.
optlen
[in, out] Pointer to the size of the optval buffer, in bytes. 参考MSDN
http://msdn.microsoft.com/