1 /**************************************************************************
2 ** (c) Copyright 2012, Andromeda Technology & Automation
3 ***************************************************************************
4 ** MODULE INFORMATION *
5 ***********************
6 ** FILE NAME : outtest.cpp
7 ** SYSTEM NAME : Network and socket classes - test routine
8 ** VERSION NUMBER : 0.1
10 ** DESCRIPTION : Output stream test.
11 ** Connects to TCP port 1234 and writes a line.
12 ** Test with: nc -l 1234
17 ***************************************************************************
18 ** ADMINISTRATIVE INFORMATION *
19 ********************************
20 ** ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
21 ** CREATION DATE : Oct 19, 2012
22 ** LAST UPDATE : Oct 30, 2012
24 **************************************************************************/
26 #include "sockstream.h"
29 /*=========================================================================
33 ** RETURN VALUE : None
35 ** DESCRIPTION : Read lines of text from port 1234 and echo these lines
42 ** LAST MODIFIED : Oct 29, 2012
43 **=========================================================================
48 IPSocketAddress serveraddress(InternetAddress("127.0.0.1"), Port(1234));
52 s.Connect(serveraddress);
53 osockstream writer(s);
56 while (std::cin >> buf)
58 writer << buf << std::endl;