First of all,your code has lot of systax error i dont known you have copy/paste that code or not.It should be return TRUE and not Return TRUE (note "R").
Now let me tell you some this about pointers.
SOCKADDR_IN socket;
SOCKET socketIdentifier;
are normal variables and
&socket
&socketIdentifier
are pointers.
and
*socket
*socketIdentifier
are values.
Now first mistak is that you parameters are pointers and your passing Values.
calling code should be like,
SOCKADDR_IN Passingsocket;SOCKET socketIdentifier;
createServerSocket(&Passingsocket,&socketIdentifier,8888); return TRUE;
This calling work fine,
Now your functions body should not containa any variable with name
"socket"
So your function body may be like,
VOID createServerSocket(SOCKADDR_IN *Passingsocket, SOCKET *socketIdentifier, int PORT)
{
WSADATA wsa;
if (WSAStartup(MAKEWORD(2,2),&wsa) != 0)
{
exit(EXIT_FAILURE);
}
if((*socketIdentifier = socket(AF_INET , SOCK_DGRAM , 0 )) == INVALID_SOCKET) {
MessageBox(NULL,
"Socket not Created",
"Failure :(",
MB_ICONINFORMATION);
exit(EXIT_FAILURE);
}
Passingsocket->sin_family = AF_INET;
Passingsocket->sin_addr.s_addr = INADDR_ANY;
Passingsocket->sin_port = htons( PORT );
if( bind(AH_glb_socketIdentifier ,(struct sockaddr *)&serverSocket , sizeof(serverSocket )) == SOCKET_ERROR)
{
MessageBox(NULL,
"Bind Failed",
"Failure :(",
MB_ICONINFORMATION);
exit(EXIT_FAILURE);
}
MessageBox(NULL,
"Bind Done",
"SUCCESS :)",
MB_ICONINFORMATION);
}
and surly this will work...