Exemple #1
0
int	extractCron::do_job(char *jobdesc)
{
	ACE_SOCK_Connector conn;
	ACE_SOCK_Stream  peer;
	ACE_Time_Value tv(3, 0);
	ACE_INET_Addr	addr(harvestPort, harvestIPaddr);
	char	urlbuff[1024];
	StrStream	httpreq;
	int	ret;

	printf("JobDesc: %s\n", jobdesc);
	CGI::escape(urlbuff, jobdesc);
	httpreq.init(2); // 2 kilobytes buff
	httpreq.rawadd("GET /harvest?expr=");
	httpreq.rawadd(urlbuff);
	httpreq.rawadd(" HTTP/1.1\n\n");

	httpreq.print();
	
	if ( conn.connect(peer, addr) < 0) {
		printf("conn failed!\n");
		return 0;
	}

	ret = peer.send( httpreq.str(), httpreq.len() );
	return 0;
	
}
void doIOTest() {
  using namespace fs;
  using Ptr = const CharT*;
  using StrStream = std::basic_stringstream<CharT>;
  const char* const InCStr = InStr;
  const Ptr E = OutStr;
  const path p((const char*)InStr);
  StrStream ss;
  { // test output
    auto& ret = (ss << p);
    assert(ss.str() == E);
    assert(&ret == &ss);
  }
  { // test input
    path p_in;
    auto& ret = ss >> p_in;
    assert(p_in.native() == (const char*)InStr);
    assert(&ret == &ss);
  }
}
Exemple #3
0
	//-------------------------------------------------------------------
	void ZenWorld::_readVobTree(ZenArchive* _zenArchive, const WorldObjectPtr& _root)
	{
		Progress& progress = Progress::getSingleton();
		progress.setPosition(_zenArchive->getDataStream()->tellg());

		StrStream ss;
		ss << "childs" << mChildID++;
		int childs = _zenArchive->readInt(ss.str());
		for(int i = 0; i != childs; ++i)
		{
			WorldObjectPtr wobj;
			if(!_root.isNull())
			{
				wobj = _zenArchive->readObject();
				if(!wobj.isNull())
				{
					_root->addChild(wobj, true);
				}
			}
			_readVobTree(_zenArchive, wobj);
		}
	}