poco-libraries

Linking error with Poco Net

◇◆丶佛笑我妖孽 提交于 2019-12-05 19:53:16
I am stuck trying to get some code to build using the POCO libraries. I get the following when I try to build Undefined symbols for architecture x86_64: "Poco::Net::SocketAddress::SocketAddress(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned short)", referenced from: ..... ld: symbol(s) not found for architecture x86_64 Now here is the catch: I am linking with -lPocoFoundation -lPocoNet -lPocoUtil What am I missing? (I should say that I am compiling with clang on Mac OS X 10.8.2 I have the same problem. I found change xcode build setting

Multiple Http Servers with Poco and Boost C++

好久不见. 提交于 2019-12-05 05:40:55
问题 I'm trying to create multiple Http servers with Poco::Net and Boost libraries, but is occurring the following error internally in Poco file Application.cpp : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Assertion violation: _pInstance == 0 [in file "src/Application.cpp", line 115] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I'm using the code below: #include <Poco/Net/HTMLForm.h> #include <Poco/Net/HTTPServerRequest.h> #include <Poco/Net/HTTPServerResponse.h> #include <boost/asio/io_service.hpp>

HttpRequest PUT content in poco library

那年仲夏 提交于 2019-12-05 05:36:23
I want to send some data from a C++ application to a server using a HTTP PUT request. I am using poco library for networking in my application. I am using this code snippet: HTTPClientSession session(_uri.getHost(), _uri.getPort()); HTTPRequest req(HTTPRequest::HTTP_PUT, path, HTTPMessage::HTTP_1_1); Where do I set the content (file) stream when I send the request? Can anyone show me an example using this library? Quoting the online documentation for HTTPClientSession : sendRequest() will return an output stream that can be used to send the request body. After you are done sending the request

How to create and parse hierarchical/nested JSON with Poco C++?

做~自己de王妃 提交于 2019-12-04 11:21:35
Edited to simplify and show my EXACT code. I have the following data that I need to serialize to JSON as well as parse from JSON. string name; std::map<string, string> metaData; I need the JSON to be nested/hierarchical like this: { "name":"john smith" "metadata": { "age":45, "middle_name":"william", }, } Here is my EXACT code: void DeserializeFromJSON(string &jsonString) { // Parse the JSON Poco::JSON::Parser jsonParser; Poco::Dynamic::Var parsedJSON = jsonParser.parse(jsonString); Poco::Dynamic::Var parsedResult = jsonParser.result(); // Extract the JSON Object Poco::DynamicStruct jsonStruct

Connect Websocket with Poco libraries

橙三吉。 提交于 2019-12-03 16:35:02
I am trying to connect to the Echo Test Websocket using the Poco C++ libraries. In order to do so here is my code which should set up the Websocket: HTTPClientSession cs("echo.websocket.org"); HTTPRequest request(HTTPRequest::HTTP_GET, "/ws"); HTTPResponse response; WebSocket* m_psock = new WebSocket(cs, request, response); m_psock->close(); //close immidiately However it does not work: I am getting an error message like this: Poco::Exception: WebSocket Exception: Cannot upgrade to WebSocket connection: Not Found Can anybody help? The 'Not Found' error is the standard HTTP 404 Not Found

How do I make an HTTP Post with HTTP Basic Authentication, using POCO?

好久不见. 提交于 2019-12-03 08:57:01
I'm trying to make an HTTP Post with HTTP Basic Authentication (cleartext username and password), using POCO. I found an example of a Get and have tried to modify it, but being a rookie I think I've mangled it beyond usefulness. Anyone know how to do this? Yes, I've already seen the other SO question on this: POCO C++ - NET SSL - how to POST HTTPS request , but I can't make sense of how it is trying to implement the username and password part. I also don't understand the use of "x-www-form-urlencoded". Is this required for a Post? I don't have a form. Just want to POST to the server with

Correct usage of Poco C++ JSON for parsing data

不羁岁月 提交于 2019-12-03 03:47:34
问题 Can anyone instruct me on how the Poco C++ JSON works? Previously I've used JsonReader and JsonToken. The Poco C++ library doesn't seem to have corresponding objects. How do I for example use the json parser to create a object name consisting the JSON value at the tag name? 回答1: EDIT: as of 1.5.2, things were simplified by making DefaultHandler, well ... default (and renaming it to its proper name - ParseHandler. So, if all you need is parsing, no need to explicitly provide the handler

How to use OpenSSL in POCO C++ library correctly

北慕城南 提交于 2019-12-02 23:22:28
According to the Specification in POCO assistant: Initialize the NetSSL library, as well as the underlying OpenSSL libraries, by calling Poco::Crypto::OpenSSLInitializer::initialize(). Should be called before using any class from the NetSSL library. The NetSSL will be initialized automatically, through Poco::Crypto::OpenSSLInitializer instances or similar mechanisms when creating Context or SSLManager instances. However, it is recommended to call initializeSSL() in any case at application startup. When I want to use HTTPSClientSession ,do I have to construct an Application object first? How

Upload a file using POCO - SSL Connection Unexpectedly Closed Exception

女生的网名这么多〃 提交于 2019-12-02 18:46:45
问题 Upload a file to a HTTPS url using POCO HTTP POST request always returns "SSL Connection Unexpectedly Closed" Exception Below is the code i am using for Multipart upload of a file.. try { Poco::URI uri(uploadLink); const Poco::Net::Context::Ptr context = new Poco::Net::Context(Poco::Net::Context::CLIENT_USE, "", "", "", Poco::Net::Context::VERIFY_NONE, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); Poco::Net::HTTPSClientSession session(uri.getHost(), uri.getPort(), context); session

Correct usage of Poco C++ JSON for parsing data

ぐ巨炮叔叔 提交于 2019-12-02 17:14:11
Can anyone instruct me on how the Poco C++ JSON works? Previously I've used JsonReader and JsonToken. The Poco C++ library doesn't seem to have corresponding objects. How do I for example use the json parser to create a object name consisting the JSON value at the tag name? Alex EDIT: as of 1.5.2, things were simplified by making DefaultHandler, well ... default (and renaming it to its proper name - ParseHandler . So, if all you need is parsing, no need to explicitly provide the handler anymore: // objects std::string json = "{ \"test\" : { \"property\" : \"value\" } }"; Parser parser; Var