帮助在c ++中发送json [英] Help sending json in c++

查看:142
本文介绍了帮助在c ++中发送json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在这个位置的Lan上有一个音乐服务器



Hi all, I have a music server on my Lan at this location

http://myipaddress:9000/jsonrpc.js





我希望以格式发布请求





and I want to post a request in the format

{\"id\":1,\"method\":\"slim.request\",\"params\":[null,[\"serverstatus\"]]}





因为这个程序需要在Android设备上运行我想用C ++做(我不想用Java做)任何想法如何在不使用外部库的情况下实现这一点?



什么我试过了:



我已经尝试创建一个套接字并向其写入原始字节但不出所料我得到一个错误的请求响应



As this program needs to run on an Android device I want to do it in C++ ( I don't want to do it in Java ) Any ideas how I can achieve this without using external libraries ?

What I have tried:

I've tried creating a socket and writing raw bytes to it but unsurprisingly I get a bad request reponse

推荐答案

除了发送这些字节之外,还有更多内容, ee C ++ json - Google搜索 [ ^ ]。
There is a bit more to it than just sending those bytes, see C++ json - Google Search[^].


这篇关于帮助在c ++中发送json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆