Previously, a new socket was being opened and closed on every call. Now, there is one socket per client which is used continuously until the connection closes.
		
			
				
	
	
		
			23 lines
		
	
	
		
			380 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			380 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef ERPC_CLIENT_HPP
 | 
						|
#define ERPC_CLIENT_HPP
 | 
						|
 | 
						|
#include <string>
 | 
						|
#include <vector>
 | 
						|
#include <netinet/in.h>
 | 
						|
 | 
						|
namespace eRPC
 | 
						|
{
 | 
						|
  class Client
 | 
						|
  {
 | 
						|
  public:
 | 
						|
    Client(std::string host, int port);
 | 
						|
    ~Client();
 | 
						|
    std::string call(std::string method, std::vector<std::string> params);
 | 
						|
  
 | 
						|
  private:
 | 
						|
    int sockfd;
 | 
						|
    sockaddr_in serverAddress;
 | 
						|
  };
 | 
						|
}
 | 
						|
 | 
						|
#endif // ERPC_CLIENT_HPP
 |