- using enum to specify command. BlockingTCPAcceptor.cpp: - added 'destroy()' to dtor - added parentheses to expressions blockingTCPCinnector.cpp: - fixed log message blockingTCPTransport.cpp: - added _socketAddress allocation - fixed waiting for timeout in 'waitUntilVerified' - fixed how many bytes are copied from the buffer responseHandlers.cpp: - added 'ConnectionValidationHandler' implementation - added 'ConnectionValidationHandler' to 'ServerResponseHandler' responseHandlers.h: - added 'ConnectionValidationHandler' declaration inetAddressUtil.cpp: - fixed all issues with sockaddr_in byte-order - removed function 'processAddressForList', using EPICSv3 'aToIPAddr' instead inetAddressUtilsTest.cpp: - fixed the tests in accordance with the correct function implementation testBlockingUDPClnt.cpp: - deleting transport at the end of the test testBlockingTCPSrv.cpp, testBlockingTCPClnt.cpp: - added tests (work in progress). Makefile: - added blockingTCP tests
54 lines
1.0 KiB
C++
54 lines
1.0 KiB
C++
/*
|
|
* testBlockingTCPSrv.cpp
|
|
*
|
|
* Created on: Jan 6, 2011
|
|
* Author: Miha Vitorovic
|
|
*/
|
|
|
|
#include "blockingTCP.h"
|
|
#include "remote.h"
|
|
#include "logger.h"
|
|
|
|
#include <iostream>
|
|
|
|
using namespace epics::pvData;
|
|
using namespace epics::pvAccess;
|
|
|
|
using std::cin;
|
|
using std::cout;
|
|
|
|
class ContextImpl : public Context {
|
|
public:
|
|
ContextImpl() :
|
|
_tr(new TransportRegistry()),
|
|
_timer(new Timer("server thread", lowPriority)) {}
|
|
virtual ~ContextImpl() {
|
|
delete _tr;
|
|
delete _timer;
|
|
}
|
|
virtual Timer* getTimer() { return _timer; }
|
|
virtual TransportRegistry* getTransportRegistry() { return _tr; }
|
|
private:
|
|
TransportRegistry* _tr;
|
|
Timer* _timer;
|
|
};
|
|
|
|
void testServerConnections() {
|
|
ContextImpl ctx;
|
|
|
|
BlockingTCPAcceptor* srv = new BlockingTCPAcceptor(&ctx, CA_SERVER_PORT,
|
|
1024);
|
|
|
|
cout<<"Press any key to stop the server...";
|
|
char c = cin.peek();
|
|
|
|
delete srv;
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
createFileLogger("testBlockingTCPSrv.log");
|
|
|
|
testServerConnections();
|
|
}
|