tag:blogger.com,1999:blog-3870801931584460413.post8775700434131903622..comments2024-01-03T11:08:42.595-08:00Comments on On Software and Languages: Casablanca C++ REST Framework - One Year Later.Marek Krjhttp://www.blogger.com/profile/16877868679118775297noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-3870801931584460413.post-70053129703063060702019-11-02T05:23:12.290-07:002019-11-02T05:23:12.290-07:00Hey very nice blog!Hey very nice blog!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-77267350814415882732017-05-24T08:33:40.138-07:002017-05-24T08:33:40.138-07:00@Pooja
it's standard if you have while(true) i...@Pooja<br />it's standard if you have while(true) in your code,it's also useless!!<br /><br />Delete itDillonhttps://www.blogger.com/profile/17940589240834997218noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-68243990700963405142017-04-27T01:32:13.485-07:002017-04-27T01:32:13.485-07:00@Ganesh
Wait a minute - "It uses interchangea...@Ganesh<br />Wait a minute - "It uses interchangeable network transport modules including one<br />based on C++ iostreams"!!! This in principle it should be possible to integrate with the Windows implementation as it defines its transport layer as iostreams... At least it would be worth to look at it.<br /><br />I should probably do it and write a blogpost about it, but at the moment it is not possible :(, sorry.Marek Krjhttps://www.blogger.com/profile/16877868679118775297noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-260862061356925922017-04-27T01:14:01.259-07:002017-04-27T01:14:01.259-07:00Hi Ganesh,
I didn't implement WebSocket suppor...Hi Ganesh,<br />I didn't implement WebSocket support in the serve, as my client didn't opt for it, but I had a look at possible implementation. <br /><br />Unfortunately I can only very dimly recall that I thought "OK, it's possible at the server side too". Basically a 3rd part library was bundled with Casablanca 2.5, quoting from its description:<br /><br />"WebSocket++ is a header only C++ library that implements RFC6455 The WebSocket<br />Protocol. It allows integrating WebSocket client and server functionality into<br />C++ programs. It uses interchangeable network transport modules including one<br />based on C++ iostreams and one based on Boost Asio"<br /><br />As it seems it could be possible to integrate it into a Casablanca server, but only on Linux/Mac. Alternatively, you'd have to change the underlying infrastructure from PPL to Asio on Windows.<br /><br />Never tried it though, and I don't know if there's any new deveolpment in curret Casablanca code - I was busy with other things.Marek Krjhttps://www.blogger.com/profile/16877868679118775297noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-33439578341380313922017-04-26T09:19:48.170-07:002017-04-26T09:19:48.170-07:00Hi Mark,
Thank you for the article. I wanted to us...Hi Mark,<br />Thank you for the article. I wanted to use Casablanca for my project and was investigating notification mechanism. It appears Casablanca has an implementation of WebSocket client, but not a server. Have you been able to implement a notification mechanism to send events to client apps? I wasn't able to find any documentation/tutorials on how to do this. Any help would be much appreciated. Thank you.<br />-ThaneshAnonymoushttps://www.blogger.com/profile/06136290028411956701noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-242139594562557052017-04-26T09:19:01.847-07:002017-04-26T09:19:01.847-07:00Hi Mark,
Thank you for the article. I wanted to us...Hi Mark,<br />Thank you for the article. I wanted to use Casablanca for my project and was investigating notification mechanism. It appears Casablanca has an implementation of WebSocket client, but not a server. Have you been able to implement a notification mechanism to send events to client apps? I wasn't able to find any documentation/tutorials on how to do this. Any help would be much appreciated. Thank you.<br />-ThaneshAnonymoushttps://www.blogger.com/profile/06136290028411956701noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-16626989241432477912017-02-16T01:48:16.556-08:002017-02-16T01:48:16.556-08:00Pooja's problem resolved - Casablanca wasn'...Pooja's problem resolved - Casablanca wasn't the culprit, blocking the main thread was. Consult your preferred Casablanca tutorial on how to use listeners.Marek Krjhttps://www.blogger.com/profile/16877868679118775297noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-2474385902491583172017-02-15T00:12:42.197-08:002017-02-15T00:12:42.197-08:00@Pooja
I'm using VS 2013, Casablanca version 2...@Pooja<br />I'm using VS 2013, Casablanca version 2.6. I don't know if there's a Casablanca version supporting VS 2012, as they have (had?) a policy of supporting only the recent 2(?) VS versions.<br /><br />I think, you should at any case use at least CS version 2.6, (+CPPREST_FORCE_PPLX) because of the performance problems I described in the blogpost - the Windows Task liblary simply doesn't cut it!Marek Krjhttps://www.blogger.com/profile/16877868679118775297noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-45790609179625896632017-02-14T17:14:24.537-08:002017-02-14T17:14:24.537-08:00Hi Marek
I need to build a http listerer using VS...Hi Marek<br /><br />I need to build a http listerer using VS2012 on windows, I am using VS2015 just for trial.<br />Could you please suggest me which casablanca build should i use for this configuration?<br /><br />Regards,<br />PoojaPoojahttps://www.blogger.com/profile/02357404511792917746noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-84366479163132820112017-02-14T00:06:23.655-08:002017-02-14T00:06:23.655-08:00@Pooja
As it looks this is a pretty standard usage...@Pooja<br />As it looks this is a pretty standard usage of Casablanca - I'm doing it in that exact manner too. However I'm still on 2.6, so maybe there are some new problems here. <br /><br />Are you on Windows or on Mac/Linux? CPPREST_FORCE_PPLX only makes sense on Windows, and as of VisualStudio 2015 is is (or it should be, I didn't check) the standard setting. However, the problems with that setup would only manifest themselves after 1000 or so files are uploaded or downloaded.<br /><br />You probably have to use profiler... 30% CPU is measures during listeners idle time? DM me on Twitter! Marek Krjhttps://www.blogger.com/profile/16877868679118775297noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-48354392173406486812017-02-13T22:36:01.557-08:002017-02-13T22:36:01.557-08:00Hi Marek,
I need your support to resolve high cp... Hi Marek, <br /><br />I need your support to resolve high cpu usage issue of cpprestsdk (casablanca).<br /><br />I wrote a http listener using cpprestsdk 2.9<br /><br />class Listener<br />{<br />public:<br />Listener() {}<br />Listener(utility::string_t url);<br /><br />pplx::task open() { return m_listener.open(); }<br />pplx::task close() { return m_listener.close(); }<br />private:<br />void handle_get_or_post(http_request message);<br /><br />http_listener m_listener;<br />};<br /><br />Listener::Listener(utility::string_t url) : m_listener(url)<br />{<br />m_listener.support(methods::GET, std::bind(&Listener::handle_get_or_post, this, std::placeholders::_1));<br />m_listener.support(methods::POST, std::bind(&Listener::handle_get_or_post, this, std::placeholders::_1));<br />}<br /><br />void Listener::handle_get_or_post(http_request message)<br />{<br />message.reply(status_codes::OK, "ACCEPTED");<br />};<br /><br />And when i run this program, cpu usage for this listerner is around 30%<br /><br />How it can be minimized? Why cpu usage is so high for cpprestsdk?<br /><br />Regards,<br />PoojaPoojahttps://www.blogger.com/profile/02357404511792917746noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-61411611032040595182017-02-13T01:27:10.721-08:002017-02-13T01:27:10.721-08:00I ran a simple listener with cpprestsdk 2.9.1 in V...I ran a simple listener with cpprestsdk 2.9.1 in VS 2015, CPU consumption is very high around 30%.<br /><br />#include <br /><br />#include <br />#include <br /><br />using namespace web;<br />using namespace web::http;<br />using namespace web::http::experimental::listener;<br />using namespace utility;<br />using namespace std;<br /><br />#define TRACE(msg) wcout << msg;<br />#define TRACE_ACTION(a, k, v) wcout << a << L" (" << k << L", " << v << L")\n";<br /><br />map dictionary;<br /><br /><br /><br />void handle_post(http_request request)<br />{<br /> TRACE(L"\nhandle POST\n");<br /><br /> utility::string_t input;<br /> input = request.to_string();<br /> utility::ofstream_t out("output.txt");<br /> out << input;<br /> out.close();<br /><br />}<br /><br />int main(int argc, char** argv)<br />{<br /><br /> http_listener listener(L"http://localhost:3277");<br /> listener.support(methods::POST, handle_post);<br /><br /><br /> try<br /> {<br /> listener<br /> .open()<br /> .then([&listener]() {TRACE(L"\nstarting to listen\n"); })<br /> .wait();<br /><br /> while (true);<br /> }<br /> catch (exception const & e)<br /> {<br /> wcout << e.what() << endl;<br /> }<br />}<br /><br />how can it be modified to perform well?<br /><br />I tried adding CPPREST_FORCE_PPLX, no change in CPU consumption.<br />Poojahttps://www.blogger.com/profile/02357404511792917746noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-24169421459536923342017-01-05T01:20:01.318-08:002017-01-05T01:20:01.318-08:00@Kalle Strunz
Not yet, but I hope I'll be able...@Kalle Strunz<br />Not yet, but I hope I'll be able to come round to solve the crash problem in the next 2 months. As for now I tested a fix which removes the crashes, but unfortunately introduces a memory leak. I couldn't proceed with that though - new features were more important for my client.Marek Krjhttps://www.blogger.com/profile/16877868679118775297noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-16840194176578853962017-01-05T00:58:09.195-08:002017-01-05T00:58:09.195-08:00Great Blog! Any new updates?Great Blog! Any new updates?Anonymoushttps://www.blogger.com/profile/02553826575600348645noreply@blogger.comtag:blogger.com,1999:blog-3870801931584460413.post-52044777722051964782016-09-20T08:50:51.390-07:002016-09-20T08:50:51.390-07:00Nice overview. Thank you for keeping us updated.Nice overview. Thank you for keeping us updated.Anonymousnoreply@blogger.com