source: trunk/ETSI-Testsuites/ETSI_auto_IOT/adapter/src/Capture/TcpipDispatch.cpp

Last change on this file was 22, checked in by rings, 14 years ago
  • Property svn:executable set to *
File size: 609 bytes
Line 
1/**
2 * @file TcpipDispatch.cpp
3 * @author Tomas Urban
4 * @version 0.2
5 * @date 23/07/2009
6 */
7#include "TcpipDispatch.h"
8#include "Logger/Logger.h"
9
10TcpipDispatch::TcpipDispatch(SOCKET_TYPE hSocket)
11{
12        m_hSocket = hSocket;
13}
14
15TcpipDispatch::~TcpipDispatch(void)
16{
17        Stop();
18}
19
20void TcpipDispatch::Stop()
21{
22        m_hSocket = 0;
23}
24
25void TcpipDispatch::DispatchData(CapturedData * pData)
26{
27        if (m_hSocket)
28        {               
29                {
30                        boost::mutex::scoped_lock lock(m_mutex);
31                        // send data
32                        send(m_hSocket, pData->GetEncodedMessage(), pData->GetEncodedDataLength(), 0);
33                }
34                Logger::Instance().LogCapture(pData->ToString());
35        }
36}
Note: See TracBrowser for help on using the repository browser.