Go to the documentation of this file.00001
00002 #include <glib.h>
00003 #include <stdio.h>
00004 #include <unistd.h>
00005 #include <sys/types.h>
00006 #include <sys/socket.h>
00007 #include <stdlib.h>
00008
00009 #include "ipc_transport.h"
00010
00011 int main ()
00012 {
00013 xmms_ipc_transport_t *transport;
00014 gint fd;
00015
00016 transport = xmms_ipc_server_init ("unix:///tmp/xmms2.socket");
00017 if (!transport) {
00018 printf ("Korv!\n");
00019 exit (-1);
00020 }
00021
00022 fd = xmms_ipc_transport_fd_get (transport);
00023
00024 while (1) {
00025 fd_set set;
00026
00027 FD_ZERO (&set);
00028 FD_SET (fd, &set);
00029
00030 printf ("Select... %d\n", fd);
00031 if (select (fd+1, &set, NULL, NULL, NULL) > 0) {
00032 gchar buffer[5];
00033
00034 xmms_ipc_transport_t *client = xmms_ipc_server_accept (transport);
00035 if (client == NULL)
00036 return 0;
00037
00038 printf ("Client connected...\n");
00039 xmms_ipc_transport_read (client, buffer, 4);
00040 printf ("%s\n", buffer);
00041 return 0;
00042 } else {
00043 return 0;
00044 }
00045 }
00046
00047 }