clone in c example

This commit is contained in:
Vinzenz Schroeter 2024-08-29 22:25:11 +02:00
parent d385d8e1d4
commit 5e141f1fbc

View file

@ -2,7 +2,7 @@
#include "servicepoint.h" #include "servicepoint.h"
int main(void) { int main(void) {
sp_Connection *connection = sp_connection_open("localhost:2342"); sp_Connection *connection = sp_connection_open("172.23.42.29:2342");
if (connection == NULL) if (connection == NULL)
return 1; return 1;
@ -11,9 +11,9 @@ int main(void) {
sp_CCommand *command = sp_command_bitmap_linear_win(0, 0, pixels, Uncompressed); sp_CCommand *command = sp_command_bitmap_linear_win(0, 0, pixels, Uncompressed);
sp_Packet *packet = sp_packet_from_command(command); sp_Packet *packet = sp_packet_from_command(command);
if (!sp_connection_send(connection, packet)) while (sp_connection_send(connection, sp_packet_clone(packet)));
return 1;
sp_packet_dealloc(packet);
sp_connection_dealloc(connection); sp_connection_dealloc(connection);
return 0; return 0;
} }