dave on Nostr: Me: #include <stdio.h> #include <libnostr.h> int main(){ // 初始化客户端 ...
Me:
#include <stdio.h>
#include <libnostr.h>
int main(){
// 初始化客户端
nostr_init("127.0.0.1", 8888);
// 建立连接
nostr_connect();
// 发送消息
char *msg = "Hello, world!";
nostr_send(msg);
// 接收消息
char recv_msg[1024] = {0};
nostr_recv(recv_msg);
// 打印接收到的消息
printf("%s\n",recv_msg);
// 关闭连接
nostr_close();
return 0;
}
Published at
2023-02-08 05:05:18Event JSON
{
"id": "954e20cf81dc804db7ce47ffe67227a705a496f5fabb9389a7c12851eef28d05",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1675832718,
"kind": 1,
"tags": [
[
"e",
"8f8e4648e0ba8324d91d6d8f144d4a816ef49be67f7ba1ad6d5e79f1d5a7fac7",
"",
"root"
],
[
"e",
"73637b8a169a477424cdeb3ce0fc2c19c7539002f64645871eaaee3856abe4b0",
"",
"reply"
],
[
"p",
"253ca0440b8302e15871315a13139c4a77e4f4493e107d482a21f77f9e32c869"
]
],
"content": "Me:\n\n#include \u003cstdio.h\u003e\n#include \u003clibnostr.h\u003e\n\nint main(){\n\n\t// 初始化客户端\n\tnostr_init(\"127.0.0.1\", 8888);\n\n\t// 建立连接\n\tnostr_connect();\n\n\t// 发送消息\n\tchar *msg = \"Hello, world!\";\n\tnostr_send(msg);\n\n\t// 接收消息\n\tchar recv_msg[1024] = {0};\n\tnostr_recv(recv_msg);\n\n\t// 打印接收到的消息\n\tprintf(\"%s\\n\",recv_msg);\n\n\t// 关闭连接\n\tnostr_close();\n\n\treturn 0;\n}",
"sig": "8826a57bc6a04e557d1e40ac22e2f6e92b40eefe82c70e15d491db7cd1f0543579b661672307c97608a853e56acecf129f156bc88b3fb5c1af8cee606df74f6d"
}