sources/main.cpp

changeset 8
8b697d30c49f
parent 5
146825d63b9a
child 10
3874575d924d
equal deleted inserted replaced
7:01e4e9ae323a 8:8b697d30c49f
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "main.h" 31 #include "main.h"
32 #include "network/bytestream.h" 32 #include "network/udpsocket.h"
33 #include "huffman/huffman.h"
33 34
34 // ------------------------------------------------------------------------------------------------- 35 // -------------------------------------------------------------------------------------------------
35 // 36 //
36 FUNCTION 37 FUNCTION
37 main (int argc, char* argv[]) -> int 38 main (int argc, char* argv[]) -> int
38 { 39 {
40 HUFFMAN_Construct();
41 Bytestream packet;
42 packet.write_byte (0x34); // header
43 packet.write_byte (0x03); // version
44 UDPSocket socket;
45 assert (socket.set_blocking (false));
46 socket.send (IPAddress (localhost, 10666), packet);
47 Datagram datagram;
48
49 while (socket.read (datagram) == false)
50 ;
51
52 printf ("Recieved datagram of %lu bytes from %s\n", datagram.data.written_length(), datagram.from.to_string (IP_WITH_PORT).chars());
53 HUFFMAN_Destruct();
54 return 0;
55
39 initscr(); 56 initscr();
40 start_color(); 57 start_color();
41 raw(); 58 raw();
42 keypad (stdscr, true); 59 keypad (stdscr, true);
43 noecho(); 60 noecho();

mercurial