简体   繁体   中英

MFC CSocket SendTo return error code 10038

I have a multicast server socket. When I realize operation SendTo of MFC CSocket, he return to me an error code 10038. That means "WSAENOTSOCK The descriptor is not a socket."

So someone can tell me how to fix this problem.

This is my code for creating the server socket

Create(AF_INET,SOCK_DGRAM,NULL);
    Bind(12234,"225.6.7.8");
    int optVal = 10;
    int i = SetSockOpt(IP_MULTICAST_TTL,(void*)&optVal,sizeof(int));

and this is the operation to send a header to client

int result = this->SendTo(header, header.GetLength(),12234,"225.6.7.8");

Thank you very much.

我认为您根本不需要绑定,因为您使用的是数据报而不是流。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM