#include <iostream>
#include "teconnection.h"
#include "teagent.h"
#include "teexception.h"
#include "teauthwinctx.h"
using namespace ERUCES;
using namespace std;
int main()
{
string strServerName = "localhost";
long lPort = 8888;
try
{
auto_ptr<TEConnection> conn =
TEConnection::createInstance(TEConnection::SecureConnection);
auto_ptr<TEWinAuthenticationContext> ctx = TEWinAuthenticationContext::getInstance();
conn->open(strServerName, lPort, *ctx.operator->());
cout << "Connected to " << strServerName << " at " << lPort
<< " as Windows user\n" << endl;
conn->close();
cout << "Disconnected from server." << endl;
}
catch (TEException &e)
{
cout << e.getAllMessages() << endl;
}
catch (...)
{
cout << "Unexpected error" << endl;
}
return 0;
}