I change to see how much bytes i received and send,and i dont use sizeof() anymore,am sending the exactly size of the packet.
Code:
	void HandleConnection()
	{
		cout << "You are connected !!!" << endl;
		char temp[30];
		int bytes_recv = Recv(temp, sizeof(temp));
		cout << "===Received=== " << bytes_recv << " bytes received" << endl;
		// Client sends 5,1,0 (version,nr of methods, the method(0 = no auth))
		if(temp[0] == 5) // test for version
		{
			char* reply = new char[2];
			reply[0] = 5; // version
			reply[1] = 0; // method choosed (no auth required)
			int bytes_sent = Send(reply, 2); // i send 5,0 (version,method choosed) i get warning that i send an unexpected answer
			cout << "---Sending-- " << bytes_sent << " bytes sent" << endl;
			delete [] reply;
			memset(temp, '\0', sizeof(temp));

			bytes_recv = Recv(temp, sizeof(temp));
			cout << "===Received=== " << bytes_recv << " bytes received" << endl;
			// i receive 5,0,0,3,14,www.google.com,80 (version,command, reserved,type of address, dest adress, dest port)
			int version = static_cast<int>(temp[0]);
			int connectionType = static_cast<int>(temp[1]);
			int adrressType = static_cast<int>(temp[3]);
			int domainLen = static_cast<int>(temp[4]);
			char* destinationAdrress = static_cast<char*>(&temp[5]);
			int port1 = static_cast<int>(temp[19]);
			int port2 = static_cast<int>(temp[20]);
			int packetSize = bytes_recv;
			cout << "Size of packet: " << packetSize << endl;
			cout << "Version: " << version << endl;
			cout << "Conn type: " << connectionType << endl;
			cout << "Adrr type: " << adrressType << endl;
			cout << "Domain lenght: " << domainLen << endl;
			cout << "Destination adrress: " << destinationAdrress << endl;
			cout << "Destination port: " << port2 << endl;
			if(version == 5) // test for version
			{
				char reply[21];
				reply[0] = 5; // version

				reply[1] = 0; // succed
				reply[2] = 0; // reserved
				reply[3] = 3; // its a domain
				reply[4] = domainLen;; // lenght of domain
				for(int j = 0; j < domainLen; ++j)
				{
					reply[j + 5] = destinationAdrress[j];
				}
				reply[5 + domainLen] = htons(port1);
				reply[6 + domainLen] = htons(port2);
				bytes_sent = Send(reply, packetSize);
				cout << "---Sending-- " << bytes_sent << " bytes sent" << endl;

				//Connect();
			}
		}


	}
And in the client program i dont get anymore that error,but remains stuck here:
Code:
[57:16] Starting: Test 1: Connection to the Proxy Server
[57:16] IP Address: 127.0.0.1
[57:16] Connection established
[57:16] Test passed.
[57:16] Starting: Test 2: Connection through the Proxy Server
[57:16] Authentication was successful.
[57:16] Connection to www.google.com:80 established through the proxy server.
Can you point what is the next stept i should do,or i i have errors in code ? Thanks for helping