14 #include <libplayerc/playerc.h> 20 playerc_client_t *client;
25 printf(
"Attempting to connect to a Player server on %s:%d\n",
29 client = playerc_client_create(NULL, host, port);
30 if (playerc_client_connect(client) != 0)
32 puts(
"Failed. Quitting." );
36 puts(
"Connected. Running tests." );
39 playerc_opaque_t *audio = playerc_opaque_create(client, 0);
40 if (playerc_opaque_subscribe(audio, PLAYER_OPEN_MODE))
44 for( i = 0; i < 1000; i++)
47 if (playerc_client_peek(client, 100) > 0)
48 playerc_client_read(client);
51 if (audio->data_count>0)
54 printf(
"%s\n", audio->data);
64 player_opaque_data_t audio_msg;
65 char *temp_str=
"Hello World!";
66 sprintf((
char *) audio_msg.data,
"%s", temp_str);
67 audio_msg.data_count=strlen(temp_str)+1;
69 playerc_opaque_cmd(audio, &audio_msg);
74 playerc_opaque_unsubscribe(audio);
75 playerc_opaque_destroy(audio);
80 puts(
"Disconnecting" );
82 playerc_client_disconnect(client);
83 playerc_client_destroy(client);
int main(int argc, const char **argv)