1 /**************************************************************************
2 ** (c) Copyright 2012, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 ** FILE NAME : http-get.cpp
7 ** SYSTEM NAME : Network and socket classes - test routine
8 ** VERSION NUMBER : 0.1
10 ** DESCRIPTION : Use a Socket object to download a page from an HTTP server.
15 ***************************************************************************
16 ** ADMINISTRATIVE INFORMATION *
17 ********************************
18 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
19 ** CREATION DATE : Mar 02, 2012
20 ** LAST UPDATE : Mar 05, 2012
22 **************************************************************************/
27 #include "sockstream.h"
30 /*=========================================================================
34 ** RETURN VALUE : None
42 ** LAST MODIFIED : Nov 01, 2012
43 **=========================================================================
48 std::cout << "Finding www.andromeda.nl\n";
49 Host server(String("www.andromeda.nl"));
50 std::list<InternetAddress> iplist = server.FindAddress();
53 std::list<Port> portlist = srv.FindAddress();
55 IPSocketAddress serveraddress(iplist.front(), portlist.front());
58 std::cout << "Connection result = " << s.Connect(serveraddress) << "\n";
61 http << "GET / HTTP/1.1\n";
62 http << "Host: www.andromeda.nl\n" << std::endl;
67 std::cout << buf << "\n";