Skip to content

UDPSocket

Jason Watkins edited this page May 12, 2015 · 1 revision

The UDPSocket class represents a UDP datagram socket used for reading data from and sending data to X-Plane Connect clients.

#####UDPSocket Methods

######Constructor Signature: explicit UDPSocket(unsigned short recvPort);

Initializes a new instance of the XPCSocket class bound to the specified receive port.

######Destructor Signature: ~UDPSocket();

Closes the underlying socket.

######Read Signature: int Read(unsigned char* buffer, int size, sockaddr* remoteAddr) const;

Reads up to size bytes into buffer and stores the remote endpoint in remoteAddr.

######SendTo Signature: void SendTo(const unsigned char* buffer, std::size_t len, sockaddr* remote) const;

Sends len bytes from buffer to the specified remote.

######GetHost Signature: static std::string GetHost(sockaddr* addr);

Converts the given sockaddr representing an IPV4 or IPV6 address to a string format. (Dotted quads fro IPV4, colon separated for IPV6.)