[ create a new paste ] login | about

Link: http://codepad.org/mbwOUXtc    [ raw code | fork ]

C++, pasted on Jan 23:
//Odcinek
void connections()//zadanie aktualnie - segregowanie użytkowników
{
		
	    sf::TcpListener listener; //nasłuchiwanie portu tcp
		listener.listen(port);
		std::vector<sf::TcpSocket*> clients; //coś ala tablica z klientami
		listener.setBlocking(true);
		selector.add(listener);
		sf::TcpSocket* client = new sf::TcpSocket;
		
		while(newconn)
		{
			if (selector.wait()) //czeka na nowego klienta
			{
				if (selector.isReady(listener))
				{

					 
					 if (listener.accept(*client) == sf::Socket::Done)
						 {
						// Add the new client to the clients list
						 clients.push_back(client);
						// Add the new client to the selector so that we will
						// be notified when he sends something
						 selector.add(*client);
						 cout << "Polaczono z nowym klientem: " << (int)client << endl;
						

						
						 
					 }
			
			
			
			
			
				


			}
		}
	}
} 
//^Zadanie// segregacja użytkowników

void fadminlogin()
{
		log:
		cout << "Login to the Administrator pannel." << endl;
		cout << "Admin Login: ";
		cin >> adminlogin;
		cout << "Admin Password: ";
		cin >> adminpass;
		if(adminlogin == "Admin123" && adminpass == "Gf3HeI11") badminlog = true;
		if(badminlog) cout << "Login suckcess! Weclome Expierence!" << endl;
		else
		{
			cout << "Login not successful! Try again." << endl;
			cout << endl;
			goto log;
		}
		cout << endl;


}

void akomendy()
{
	cout << "Insert command here or type '!help' for actually command list." << endl;
	cout << "Text: ";
}

void checkupd()
{
		socket.receive(start);
		start >> update;
		if(update != Sver)
		{
			cout << "Not actuall verision of client. Sending back...";
			std::string wiad2 = "Serwer: Verision of your klient is unactuall. Please schearch for new updates.";
			
			
			//pak2.clear();
		}
}

void sockets()
{
	
}


Create a new paste based on this one


Comments: