Skip to content
UDP_Protocol.h 685 B
Newer Older
Valerio Pastore's avatar
Valerio Pastore committed
/*
 *
 *  Created on: Mar 1, 2021
 *      Author: astrisw
 */
Valerio Pastore's avatar
Valerio Pastore committed
#ifndef UDP_PROTOCOL_H_
#define UDP_PROTOCOL_H_
Valerio Pastore's avatar
Valerio Pastore committed

#include <Base_Protocol.h>

/*
Valerio Pastore's avatar
Valerio Pastore committed
 * class UDPProtocol
Valerio Pastore's avatar
Valerio Pastore committed
 * Implementation of a UDP socket
 * @member field fd_sock: socket file descriptor
 * @member field sockaddr_in: struct of the client address.
 */
Valerio Pastore's avatar
Valerio Pastore committed
namespace inaf::oasbo::ConnectionProtocols{
Valerio Pastore's avatar
Valerio Pastore committed

class UDPProtocol : public BaseProtocol{
protected:
	int fd_sock; //file descriptor
	struct sockaddr_in cliaddr;
	struct sockaddr_in srvaddr;

public:
	UDPProtocol(std::string hs, int prt);
	int connectToClient();
	int connectToServer();

Valerio Pastore's avatar
Valerio Pastore committed
// Template implementation
#include <UDP_Protocol.tpp>

Valerio Pastore's avatar
Valerio Pastore committed

Valerio Pastore's avatar
Valerio Pastore committed
};
}
#endif /* UDP_PROTOCOL_H_ */