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

#include <Base_Protocol.h>

/*
 * class UDPSocket
 * Implementation of a UDP socket
 * @member field fd_sock: socket file descriptor
 * @member field sockaddr_in: struct of the client address.
 */

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();
	int rcvPacketFromCli(BasePacket &);
	int sendPacketToSrv(BasePacket &);

};

#endif /* UDPSOCKET_H_ */