22 #ifndef INCLUDE_UDPSOCKET_H_ 23 #define INCLUDE_UDPSOCKET_H_ 28 #include <sys/types.h> 29 #include <sys/socket.h> 31 #include <arpa/inet.h> 33 #include <netinet/in.h> 65 virtual const char*
what()
const throw (){
return m_sMsg.c_str(); }
87 TcpSocket = SOCK_STREAM,
88 UdpSocket = SOCK_DGRAM,
97 IPv4Protocol = AF_INET,
98 IPv6Protocol = AF_INET6,
99 UnknownNetworkLayerProtocol = -1
108 DATA_TIMED_OUT = ETIMEDOUT,
118 string GetLocalAddress();
126 unsigned short GetLocalPort();
136 void BindLocalPort(
unsigned short localPort);
147 void BindLocalAddressAndPort(
const string &localAddress,
unsigned short localPort = 0);
153 unsigned long int GetReadBufferSize ();
159 void SetReadBufferSize(
unsigned int nSize);
165 void SetNonBlocking(
bool bBlocking);
174 void ConnectToHost(
const string &foreignAddress,
unsigned short foreignPort);
183 void Send(
const void *buffer,
int bufferLen);
193 int Recv(
void *buffer,
int bufferLen);
200 string GetPeerAddress();
207 unsigned short GetPeerPort();
223 virtual int OnDataRead(
unsigned long timeToWait = ULONG_MAX);
229 void SetBindToDevice(
const string& sInterface);
239 static void FillAddr(
const string & localAddress,
unsigned short localPort, sockaddr_in& localAddr );
244 void operator=(
const CSocket &sock);
272 UDPSocket(
const string &localAddress,
unsigned short localPort);
285 void DisconnectFromHost();
297 void SendDataGram(
const void *buffer,
int bufferLen,
const string &foreignAddress,
298 unsigned short foreignPort);
310 int RecvDataGram(
void *buffer,
int bufferLen,
string &sourceAddress,
311 unsigned short &sourcePort);
318 void SetMulticastTTL(
unsigned char multicastTTL);
325 void JoinGroup(
const string &multicastGroup);
332 void LeaveGroup(
const string &multicastGroup);
virtual const char * what() const
QDataStream & operator>>(QDataStream &ds, AudioDeviceManager::InputDeviceInfo &info)
QDataStream & operator<<(QDataStream &ds, const AudioDeviceManager::InputDeviceInfo &info)