makefiles

git-svn-id: svn://elaine/murooma/trunk@176 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-08-10 14:54:47 +00:00
parent 0bfe37bd03
commit b94da4f1aa
6 changed files with 22 additions and 124 deletions

View file

@ -1,89 +0,0 @@
//
// blocking_tcp_echo_client.cpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <boost/asio.hpp>
#include <chrono>
#include <ctime> // localtime
#include <sstream> // stringstream
#include <iomanip>
using boost::asio::ip::tcp;
using namespace std;
using namespace std::chrono;
enum { max_length = 1024 };
std::string return_current_time_and_date()
{
auto now = system_clock::now();
auto in_time_t = system_clock::to_time_t(now);
system_clock::duration ms = now.time_since_epoch();
char buff[20];
strftime(buff, 20, "%Y-%m-%d %H:%M:%S", localtime(&in_time_t));
stringstream ss;
ss << buff << "." << std::setw(3) << std::setfill('0') << ((ms / milliseconds(1)) % 1000);
return ss.str();
}
int main(int argc, char* argv[])
{
if (argc != 3)
{
std::cerr << "Usage: blocking_tcp_echo_client <host> <port>\n";
return 1;
}
try
{
boost::asio::io_service io_service;
tcp::resolver resolver(io_service);
tcp::resolver::query query(tcp::v4(), argv[1], argv[2]);
tcp::resolver::iterator iterator = resolver.resolve(query);
while (true)
{
try
{
tcp::socket s(io_service);
s.connect(*iterator);
boost::array<char, 128> buf;
boost::system::error_code error;
while (true)
{
size_t len = s.read_some(boost::asio::buffer(buf), error);
if (error == boost::asio::error::eof)
break;
std::cout.write(buf.data(), len);
std::cout.flush();
}
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
usleep(100*1000);
}
}
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}

View file

@ -1,25 +1,18 @@
VERSION = 0.01
CC = /usr/bin/g++
CFLAGS = -std=gnu++0x -Wall -Wno-unused-function -g -O3 -D_REENTRANT -DVERSION=\"$(VERSION)\"
CFLAGS = -std=gnu++0x -Wall -Wno-unused-function -g -O3 -D_REENTRANT -DVERSION=\"$(VERSION)\" -I..
LDFLAGS = -lrt -lpthread -lportaudio -lboost_system
OBJ_SERVER = blocking_tcp_echo_server.o
BIN_SERVER = server
OBJ_CLIENT = client.o stream.o chunk.o
BIN_CLIENT = client
OBJ = $(OBJ_SERVER) $(OBJ_CLIENT)
OBJ = snapClient.o stream.o ../common/chunk.o
BIN = SnapClient
all: server client
server: $(OBJ)
$(CC) $(CFLAGS) -o $(BIN_SERVER) $(OBJ_SERVER) $(LDFLAGS)
all: client
client: $(OBJ)
$(CC) $(CFLAGS) -o $(BIN_CLIENT) $(OBJ_CLIENT) $(LDFLAGS)
$(CC) $(CFLAGS) -o $(BIN) $(OBJ) $(LDFLAGS)
%.o: %.cpp
$(CC) $(CFLAGS) -c $<
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(BIN_SERVER) $(BIN_CLIENT) $(OBJ) $(OBJ_SERVER) $(OBJ_CLIENT)
rm -rf $(BIN) $(OBJ)

View file

@ -16,8 +16,8 @@
#include <portaudio.h>
#include <boost/asio.hpp>
#include "chunk.h"
#include "utils.h"
#include "common/chunk.h"
#include "common/utils.h"
#include "stream.h"
using boost::asio::ip::tcp;

View file

@ -8,9 +8,9 @@
#include <vector>
#include <memory>
#include "doubleBuffer.h"
#include "chunk.h"
#include "timeUtils.h"
#include "queue.h"
#include "common/chunk.h"
#include "common/timeUtils.h"
#include "common/queue.h"
class Stream

View file

@ -1,25 +1,19 @@
VERSION = 0.01
CC = /usr/bin/g++
CFLAGS = -std=gnu++0x -Wall -Wno-unused-function -g -O3 -D_REENTRANT -DVERSION=\"$(VERSION)\"
CFLAGS = -std=gnu++0x -Wall -Wno-unused-function -g -O3 -D_REENTRANT -DVERSION=\"$(VERSION)\" -I..
LDFLAGS = -lrt -lpthread -lportaudio -lboost_system
OBJ_SERVER = blocking_tcp_echo_server.o
BIN_SERVER = server
OBJ_CLIENT = client.o stream.o chunk.o
BIN_CLIENT = client
OBJ = $(OBJ_SERVER) $(OBJ_CLIENT)
OBJ = snapServer.o
BIN = SnapServer
all: server client
all: server
server: $(OBJ)
$(CC) $(CFLAGS) -o $(BIN_SERVER) $(OBJ_SERVER) $(LDFLAGS)
client: $(OBJ)
$(CC) $(CFLAGS) -o $(BIN_CLIENT) $(OBJ_CLIENT) $(LDFLAGS)
$(CC) $(CFLAGS) -o $(BIN) $(OBJ) $(LDFLAGS)
%.o: %.cpp
$(CC) $(CFLAGS) -c $<
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(BIN_SERVER) $(BIN_CLIENT) $(OBJ) $(OBJ_SERVER) $(OBJ_CLIENT)
rm -rf $(BIN) $(OBJ)

View file

@ -21,9 +21,9 @@
#include <iomanip>
#include <thread>
#include <memory>
#include "chunk.h"
#include "timeUtils.h"
#include "queue.h"
#include "common/chunk.h"
#include "common/timeUtils.h"
#include "common/queue.h"
using boost::asio::ip::tcp;