Logo Search packages:      
Sourcecode: libmpdclient version File versions  Download package

mpd_malloc struct mpd_async* mpd_async_new ( int  fd  )  [read]

Creates a new asynchronous MPD connection, based on a stream socket connected with MPD.

Parameters:
fd the socket file descriptor of the stream connection to MPD
Returns:
a mpd_async object, or NULL on out of memory

Definition at line 71 of file async.c.

References mpd_async::error, mpd_async::fd, mpd_async::input, mpd_async_new(), and mpd_async::output.

Referenced by mpd_async_new(), and mpd_connection_new().

{
      struct mpd_async *async;

      assert(fd >= 0);

      async = malloc(sizeof(*async));
      if (async == NULL)
            return NULL;

      async->fd = fd;
      mpd_error_init(&async->error);

      mpd_buffer_init(&async->input);
      mpd_buffer_init(&async->output);

      return async;
}


Generated by  Doxygen 1.6.0   Back to index