sources/network/udpsocket.cpp

branch
protocol5
changeset 159
970d58a01e8b
parent 153
82aac80a2f1d
parent 158
de7574d292ad
child 171
d0fba0d7ad03
--- a/sources/network/udpsocket.cpp	Wed Jul 20 18:31:19 2016 +0300
+++ b/sources/network/udpsocket.cpp	Fri Jul 22 17:59:55 2016 +0300
@@ -141,17 +141,16 @@
 		decodedPacket, length, &decodedLength);
 	datagram.address.host = ntohl (claddr.sin_addr.s_addr);
 	datagram.address.port = ntohs (claddr.sin_port);
-	datagram.message = Bytestream (decodedPacket, decodedLength);
+	datagram.message = ByteArray(decodedPacket, decodedLength);
 	return true;
 }
 
 // -------------------------------------------------------------------------------------------------
 //
-bool UDPSocket::send (const IPAddress& address, const Bytestream& data)
+bool UDPSocket::send (const IPAddress& address, const ByteArray& data)
 {
 	int encodedlength = sizeof HuffmanBuffer;
-	HUFFMAN_Encode (data.data(), reinterpret_cast<unsigned char*> (HuffmanBuffer),
-		data.written_length(), &encodedlength);
+	HUFFMAN_Encode (data.data(), reinterpret_cast<unsigned char*> (HuffmanBuffer), data.size(), &encodedlength);
 	sockaddr_in claddr = address.to_sockaddr_in();
 	int res = ::sendto (m_socket, HuffmanBuffer, encodedlength, 0,
 		reinterpret_cast<sockaddr*> (&claddr), sizeof claddr);

mercurial