| Basically the functions that I'm using to send are the following: | | PS: the second function, gst_dccp_send_buffer, is a call back function | called by gstreamer when it has data to be sent. Thank you. | /* write buffer to given socket incrementally. | * Returns number of bytes written. | */ | gint | gst_dccp_socket_write (int socket, const void *buf, size_t count) | { | size_t bytes_written = 0; | ssize_t wrote; | | while (bytes_written < count) { | wrote = send (socket, (const char *) buf + bytes_written, | count - bytes_written, MSG_NOSIGNAL); | if (wrote <= 0) { | return bytes_written; | } | bytes_written += wrote; | } /* something like (but do have a look at the paraslash sources) do { wrote = send (socket, (const char *) buf + bytes_written, count - bytes_written, MSG_NOSIGNAL); } while (wrote < 0 && errno == EAGAIN); */ If the function below is a callback, then this may be tricky, since the solution is to poll (the above do..while loop), until there is room in the sender's TX queue. In principle, you could use the same do..while loop, or decide to store the chunk back into a list and reschedule the callback to "call later", as it is done in the paraslash sources. | | /* write a GDP header to the socket. Return false if fails. */ | GstFlowReturn | gst_dccp_send_buffer (GstElement * this, GstBuffer * buffer, int socket) | { | size_t wrote; | | gint size = 0; | guint8 *data; | | size = GST_BUFFER_SIZE (buffer); | data = GST_BUFFER_DATA (buffer); | | GST_LOG_OBJECT (this, "writing %d bytes for GDP buffer header\n", size); | printf("writing %d bytes for GDP buffer header\n\n", size); | wrote = gst_dccp_socket_write (socket, data, size); | //g_free (data); | | if (wrote != size) { | GST_ELEMENT_ERROR (this, CORE, TOO_LAZY, (NULL), | ("Error while sending data")); | printf("Error while sending data\n"); | return GST_FLOW_ERROR; | } | | return GST_FLOW_OK; | } | - To unsubscribe from this list: send the line "unsubscribe dccp" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html