sources/network/udpsocket.cpp

changeset 186
9330b93d9946
parent 183
9b6a0daedfc0
child 189
248d0b85cbda
equal deleted inserted replaced
185:e83ec58cc458 186:9330b93d9946
139 return true; 139 return true;
140 } 140 }
141 141
142 // ------------------------------------------------------------------------------------------------- 142 // -------------------------------------------------------------------------------------------------
143 // 143 //
144 bool UDPSocket::send (const IPAddress& address, const ByteArray& data) 144 bool UDPSocket::send (const net::ip_address& address, const ByteArray& data)
145 { 145 {
146 int encodedlength = sizeof HuffmanBuffer; 146 int encodedlength = sizeof HuffmanBuffer;
147 HUFFMAN_Encode (data.data(), reinterpret_cast<unsigned char*> (HuffmanBuffer), data.size(), &encodedlength); 147 HUFFMAN_Encode (data.data(), reinterpret_cast<unsigned char*> (HuffmanBuffer), data.size(), &encodedlength);
148 sockaddr_in claddr = address.to_sockaddr_in(); 148 sockaddr_in claddr = net::ip_address_to_sockaddr_in(address);
149 int res = ::sendto (m_socket, HuffmanBuffer, encodedlength, 0, 149 int res = ::sendto (m_socket, HuffmanBuffer, encodedlength, 0,
150 reinterpret_cast<sockaddr*> (&claddr), sizeof claddr); 150 reinterpret_cast<sockaddr*> (&claddr), sizeof claddr);
151 151
152 if (res == -1) 152 if (res == -1)
153 { 153 {

mercurial