the code keeps crashing i tried to know whish state it crashes in but didnt know
Code:
#include "inc.h"
void connect()
{
u_long iMode = 1;
SOCKET SITE;
SOCKADDR_IN serverinfo;
LPHOSTENT hostEntry;
hostEntry = gethostbyname("www.yahoo.com"); // Specifying the server by its name;
SITE=socket(AF_INET,//we gonna use internet
SOCK_STREAM,//best effor socks
IPPROTO_UDP);//we gonna use tcp protocol
//next is our strctre of stuff
serverinfo.sin_family=AF_INET;
serverinfo.sin_addr = *((LPIN_ADDR)*hostEntry->h_addr_list);
serverinfo.sin_port=htons(80);
if(ioctlsocket(SITE,FIONBIO,&iMode)==INVALID_SOCKET)//we begin using our non blocking sockets
{
MessageBox(NULL,"FUNCTION FAILED","FAILURE",MB_OK);
exit(0);
}
connect(SITE,(SOCKADDR*)&serverinfo,sizeof serverinfo);
}
int WINAPI WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd )
{
connect();
}