/*!
  \file
  \brief クライアント側

  \author Satofumi KAMIMURA

  $Id: ClientThread.cpp 1138 2009-07-13 10:40:08Z satofumi $
*/

#include "ClientThread.h"
#include "port.h"
#include <QTcpSocket>
#include <QApplication>


struct ClientThread::pImpl
{
  QTcpSocket tcp_socket_;
};


ClientThread::ClientThread(void) : pimpl(new pImpl)
{
}


ClientThread::~ClientThread(void)
{
}


void ClientThread::run(void)
{
  fprintf(stderr, "client thread: %p\n", this);
  fprintf(stderr, "tcp_socket_: %p\n", &pimpl->tcp_socket_);

  pimpl->tcp_socket_.connectToHost("localhost", Port);
  enum { Timeout = 1000 };
  if (! pimpl->tcp_socket_.waitForConnected(Timeout)) {
    fprintf(stderr, "client: connection fail.\n");
    return;
  }

  // !!!
}
