sources/main.cpp

changeset 8
8b697d30c49f
parent 5
146825d63b9a
child 10
3874575d924d
--- a/sources/main.cpp	Thu Dec 11 06:13:32 2014 +0200
+++ b/sources/main.cpp	Thu Dec 11 07:18:11 2014 +0200
@@ -29,13 +29,30 @@
 */
 
 #include "main.h"
-#include "network/bytestream.h"
+#include "network/udpsocket.h"
+#include "huffman/huffman.h"
 
 // -------------------------------------------------------------------------------------------------
 //
 FUNCTION
 main (int argc, char* argv[]) -> int
 {
+	HUFFMAN_Construct();
+	Bytestream packet;
+	packet.write_byte (0x34); // header
+	packet.write_byte (0x03); // version
+	UDPSocket socket;
+	assert (socket.set_blocking (false));
+	socket.send (IPAddress (localhost, 10666), packet);
+	Datagram datagram;
+
+	while (socket.read (datagram) == false)
+		;
+
+	printf ("Recieved datagram of %lu bytes from %s\n", datagram.data.written_length(), datagram.from.to_string (IP_WITH_PORT).chars());
+	HUFFMAN_Destruct();
+	return 0;
+
 	initscr();
 	start_color();
 	raw();

mercurial