📄 udpsocket.h
字号:
/* File: UDPSocket.h Contains: Adds additional Socket functionality specific to UDP. */#ifndef __UDPSOCKET_H__#define __UDPSOCKET_H__#ifndef __Win32__#include <sys/socket.h>#include <sys/uio.h>#endif#include "Socket.h"class UDPSocket : public Socket{ public: //Another socket type flag (in addition to the ones defined in Socket.h). //The value of this can't conflict with those! enum { kWantsDemuxer = 0x0100 //UInt32 }; UDPSocket(); virtual ~UDPSocket() {} //Open OS_Error Open() { return Socket::Open(SOCK_DGRAM); } OS_Error SetRemoteAddr(UInt32 inRemoteAddr, UInt16 inRemotePort); OS_Error JoinMulticast(UInt32 inRemoteAddr); OS_Error LeaveMulticast(UInt32 inRemoteAddr); OS_Error SetTtl(UInt16 timeToLive); OS_Error SetMulticastInterface(UInt32 inLocalAddr); //returns an ERRNO OS_Error SendTo(const char* inBuffer, UInt32 inLength); OS_Error SendTo(UInt32 inRemoteAddr, UInt16 inRemotePort, void* inBuffer, UInt32 inLength); OS_Error RecvFrom(void* ioBuffer, UInt32 inBufLen, UInt32* outRecvLen); OS_Error RecvFrom(UInt32* outRemoteAddr, UInt16* outRemotePort, void* ioBuffer, UInt32 inBufLen, UInt32* outRecvLen); private: struct sockaddr_in m_theRemoteAddr; struct sockaddr_in fMsgAddr; // ?};#endif // __UDPSOCKET_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -