组播发送
**************************************************************************************************************
#include
#include
#include
#include
#include
#include
#include
#include
//本机IP
#define PORT 8888
#define IP "192.168.43.148"
//组播地址
#define mu_IP "224.1.2.3"
#define ERR_MSG(msg) do{\
fprintf(stderr,"__%d__\n",__LINE__);\
perror("msg");\
}while(0)
int main(int argc, const char *argv[])
{
//1、创建套接字
int sfd = socket(AF_INET,SOCK_DGRAM,0);
if(sfd<0)
{
ERR_MSG("socket");
return -1;
}
//加入多播组<