MS에서 흥미로운 SDK를 내놨네요.
Casablanca is a Microsoft incubation effort to support cloud-based client-server communication in native code using a modern asynchronous C++ API design.
- Support for accessing REST services from native code on Windows Vista, Windows 7, and Windows 8 Consumer Preview by providing asynchronous C++ bindings to HTTP, JSON, and URIs
- A Visual Studio extension SDK to help you write C++ HTTP client side code in your Windows 8 Metro style app
- Support for writing native-code REST for Azure, including Visual Studio integration
- Convenient libraries for accessing Azure blob and queue storage from native clients as a first class Platform-as-a-Service (PaaS) feature
- A consistent and powerful model for composing asynchronous operations based on C++ 11 features
- A C++ implementation of the Erlang actor-based programming model
- A set of samples and documentation
샘플코드를 보니 http client나 lisener를 쉽게 구현할 수 있더군요.
g_listener = http_listener::create(uri.to_uri(),
// GET
[](http_request message)
{
message.reply(http::status_codes::OK, "Hello World!");
log::post(actors::LOG_INFO, "Serviced a GET request for " + message.request_uri().to_string());
},
// PUT
[](http_request message)
{
message.reply(http::status_codes::OK, "Hello World!");
log::post(actors::LOG_INFO, "Serviced a PUT request " + message.request_uri().to_string());
},
// POST
[](http_request message)
{
message.reply(http::status_codes::OK, "Hello World!");
log::post(actors::LOG_INFO, "Serviced a POST request " + message.request_uri().to_string());
},
// DELETE
[](http_request message)
{
message.reply(http::status_codes::OK, "Hello World!");
log::post(actors::LOG_INFO, "Serviced a DELETE request " + message.request_uri().to_string());
});
g_listener.open();
이런식으로 마치 웹서버 처럼 특정 URI의 http request에 대응하는 lambda함수를 등록시켜서 사용할 수도 있구요. ^^
http_client bing( L”http://www.bing.com/search” );
bing.request( methods::GET, L”?q=S.Somasegar” )
.then( []( http_response response ) {
cout << “HTML SOURCE:” << endl << response.to_string() << endl; })
.wait();
이런식으로 client도 C++11스타일로 간단하게 구현이 가능하더군요.
잘만 된다면 게임서버가 마치 웹서버처럼 동작하면서 브라우저와 통신이 가능하게 만들수 있을거 같더라구요.
공유하기 버튼
|
|










최근 덧글