Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualpatrrr

Posted 11 April 2013 - 07:45 AM

Then it's not static, it would look like this if it was:

 

static DWORD WINAPI RecvThread(LPVOID);

 

I can see you're also using class instance variables in RecvThread; "Socket", "RemoteAddress", etc. They're not accessible due to the function being static.

You can use "knock" as the object instance, like this:

DWORD WINAPI Application::RecvThread(LPVOID knock)
{
	Application *instance = static_cast<Application *>(knock);
	while(true)
	{
		PLAYER Recv;
		recvfrom(instance->Socket, (char*)&Recv, sizeof(PLAYER), 0, (sockaddr*)&instance->RemoteAddress, &SizeInt);

		Player = Recv;
	}
}

#2patrrr

Posted 11 April 2013 - 07:45 AM

Then it's not static, it would look like this if it was:

 

static DWORD WINAPI RecvThread(LPVOID);

 

I can see you're also using object instance variables in RecvThread; "Socket", "RemoteAddress", etc. They're not accessible due to the function being static.

You can use "knock" as the object instance, like this:

DWORD WINAPI Application::RecvThread(LPVOID knock)
{
	Application *instance = static_cast<Application *>(knock);
	while(true)
	{
		PLAYER Recv;
		recvfrom(instance->Socket, (char*)&Recv, sizeof(PLAYER), 0, (sockaddr*)&instance->RemoteAddress, &SizeInt);

		Player = Recv;
	}
}

#1patrrr

Posted 11 April 2013 - 07:45 AM

Then it's not static, it would look like this:

 

static DWORD WINAPI RecvThread(LPVOID);

 

I can see you're also using object instance variables in RecvThread; "Socket", "RemoteAddress", etc. They're not accessible due to the function being static.

You can use "knock" as the object instance, like this:

DWORD WINAPI Application::RecvThread(LPVOID knock)
{
	Application *instance = static_cast<Application *>(knock);
	while(true)
	{
		PLAYER Recv;
		recvfrom(instance->Socket, (char*)&Recv, sizeof(PLAYER), 0, (sockaddr*)&instance->RemoteAddress, &SizeInt);

		Player = Recv;
	}
}

 

 


PARTNERS