1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00
vdr-plugin-satip/socket.h
nafets227 382e1dedef Performance enhancement via recvmmsg().
Use recvmmsg() in order to read multiple packets with one system call.
This improves performance, especially in have loaded areas when catching up
a log of queued packets.

Original patch tweaked and optimized by Rolf Ahrenberg.
2014-12-14 15:39:18 +02:00

35 lines
916 B
C++

/*
* socket.h: SAT>IP plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
*/
#ifndef __SATIP_SOCKET_H
#define __SATIP_SOCKET_H
#include <arpa/inet.h>
class cSatipSocket {
private:
int socketPortM;
int socketDescM;
struct sockaddr_in sockAddrM;
public:
cSatipSocket();
virtual ~cSatipSocket();
bool Open(const int portP = 0);
virtual void Close(void);
int Fd(void) { return socketDescM; }
int Port(void) { return socketPortM; }
bool IsOpen(void) { return (socketDescM >= 0); }
bool Flush(void);
int Read(unsigned char *bufferAddrP, unsigned int bufferLenP);
int ReadMulti(unsigned char *bufferAddrP, unsigned int *elementRecvSizeP, unsigned int elementCountP, unsigned int elementBufferSizeP);
bool Write(const char *addrP, const unsigned char *bufferAddrP, unsigned int bufferLenP);
};
#endif // __SATIP_SOCKET_H