I'm developing an after effects plugin and I'm trying to integrate raknet which is a c++ network library. When the raknet library is trying to get the ipv4 address by calling
gethostbyname
it then throws an error access violation reading location 0xFFFFFFFFFFFFFFFF
int idx=0;
char ac[ 80 ];
int err = gethostname( ac, sizeof( ac ) );
(void) err;
RakAssert(err != -1);
struct hostent *phe = gethostbyname( ac );
if ( phe == 0 )
{
RakAssert(phe!=0);
return ;
}
for ( idx = 0; idx < MAXIMUM_NUMBER_OF_INTERNAL_IDS; ++idx )
{
if (phe->h_addr_list[ idx ] == 0)
break;
memcpy(&addresses[idx].address.addr4.sin_addr,phe->h_addr_list[ idx ], sizeof(struct in_addr));
}
while (idx < MAXIMUM_NUMBER_OF_INTERNAL_IDS)
{
addresses[idx]=UNASSIGNED_SYSTEM_ADDRESS;
idx++;
}
Here are some pictures of what I see.
http://jacobsgriffith.com/stackoverflow/noaccesserror.png
I've read this and it doesn't look like the library implemented it wrong. Microsoft Documentation On gethostbyname
When I hover over h_addr_list and h_aliases I get .
http://jacobsgriffith.com/stackoverflow/noaccess.jpg
Anybody have any ideas? Why is this failing I'm pretty sure this is a common function.
Another thing, is there any difference between the implementations of the gethostbyname function from winsock and winsock2?