IPv 6ベースのマルチキャスト通信

2118 ワード

Client:
//   

#include 
#include 
#include 
#include 
//#include "tpipv6.h"
#include 

#pragma comment(lib,"ws2_32.lib")

using namespace std;

#define HELLO_PORT  7905  //        
#define HELLO_GROUP "FF02::99"//"224.0.0.99"//"228.4.5.6"   //        224.0.1.0 - 238.255.255.255
#define BUFFER_SIZE 1024



//          ,        

int main()
{
	cout<ai_family, res->ai_socktype, res->ai_protocol); 


	/************         **************/
	int ret ;
	const int on = 1; //                  
	ret = setsockopt(sockClt, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on));
	if( ret == SOCKET_ERROR )
	{
		WSACleanup();

		cout<ai_addr, res->ai_addrlen);//      
	//cout<ai_addr),wht,80)<

Server:
//   

#include 
#include 
#include 
//#include "tpipv6.h"
#include 

#pragma comment(lib,"ws2_32.lib")

using namespace std;


#define HELLO_PORT  7905  //        
#define HELLO_GROUP "FF02::99"//              
#define BUFFER_SIZE 1024

int main()
{
	cout<ai_family, res->ai_socktype, res->ai_protocol); 

	//char wht[80];
	//cout<ai_addr->sa_data[15]<ai_addr),wht,80)<ai_addr,res->ai_addrlen);
	}

	return 0;
}