我想用SOCKET的多播组功能,在MFC应用程序里面,用setsockopt(sok,IPPROTO_IP,IP_ADD_MEMBERSHIP,(char*)&ipmr,sizeof(ipmr))没问题,程序运行正常,想把这功能做到动态库里面,结果在动态库里面,同样的代码setsockopt(sok,IPPROTO_IP,IP_ADD_MEMBERSHIP,(char*)&ipmr,sizeof(ipmr)),却返回10042错误:Bad protocol option。有什么好的解决办法吗?
解决方案 »
- Windows中互斥信号量问题出错
- 求助:在单独线程中的CDatabase类OpenEx()操作引起主线程界面阻塞
- 一个关于边框的问题
- 请教,如何在VC++6.0中连接到SQL Server2000数据库中制定的表中?! 急急!
- 第一次拿到奖金。
- 關於多語言工程的問題.
- 为什么两次编译后的exe文件内容不一样,没有更改任何代码
- 不使用MFC的dll如何获得用户输入?(除了使用剪贴版)
- 怎样去掉2000professional下的那些滴滴声?
- 用application wizard创建项目以后想改变窗口的一些style
- glu2d3d.dll是什么
- windows和linux之间的数据通信,数据的形式以结构体的形式传送可以吗
显然你的套接字选项有误!
The setsockopt function sets a socket option.
int setsockopt(
__in SOCKET s,
__in int level,
__in int optname,
__in const char* optval,
__in int optlen
);Parameters
s
A descriptor that identifies a socket.level
The level at which the option is defined (for example, SOL_SOCKET).optname
The socket option for which the value is to be set (for example, SO_BROADCAST). The optname parameter must be a socket option defined within the specified level, or behavior is undefined.optval
A pointer to the buffer in which the value for the requested option is specified.optlen
The size, in bytes, of the optval buffer.
你看下在你的应用程序里,有没有对IPPROTO_IP和IP_ADD_MEMBERSHIP的define,再看看和dll里的define是不是一样???