hi,
i am new in this language i made little progress but still have issue with this 3 red lines anyone can help me with it please.
Code:
#include <winsock2.h>
#include <windows.h>
#include <iostream>
using namespace std;
#define hosty "localhost"
#define page "update/check.php"
int check()
{
char temp;
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) {
cout << "WSAStartup failed.\n";
system("pause");
return 1;
}
SOCKET Socket=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
struct hostent *host;
host = gethostbyname(hosty);
SOCKADDR_IN SockAddr;
SockAddr.sin_port=htons(80);
SockAddr.sin_family=AF_INET;
SockAddr.sin_addr.s_addr = *((unsigned long*)host->h_addr);
if(connect(Socket,(SOCKADDR*)(&SockAddr),sizeof(SockAddr)) != 0){
return 1;
}
send(Socket,"GET /" page " HTTP/1.1\r\nHost: " hosty "\r\nConnection: close\r\n\r\n", strlen("GET /" page " HTTP/1.1\r\nHost: " hosty "\r\nConnection: close\r\n\r\n"),0);
char buffer[10000];
int nDataLength;
temp = "";
while ((nDataLength = recv(Socket,buffer,10000,0)) > 0){
int i = 0;
while (buffer[i] >= 32 || buffer[i] == '\n' || buffer[i] == '\r') {
cout << buffer[i];
temp = temp & buffer[i];
i += 1;
}
}
closesocket(Socket);
WSACleanup();
}
int main()
{
for(;;)
{
check();
printf("\nchecked.");
Sleep(10000);
}
return 0;
}