sendfile through GIOChannel



Hi there!

I'm building a application which makes extensive use of GLib. Since it
is a network application, it uses sockets, so I decided to use the
GIOChannel to have a nice higher level on top of sockets. It is working
flawlessly. 

But I have a problem: my application requires the send of files through
the socket. The way I'm doing this right now is, read a fixed buffer
data from the file and write it to the GIOChannel. I know this to be
very inefficient. I'm copying data from the kernel space to the user
space, only to send it through kernel space again.

With raw sockets I could use the sendfile system call that allows me to
pass this job of transferring streams to the kernel. So my question is:
is it possible to use sendfile with GIOChannel? Is there any other
efficient alternative? Am I forced to use the "read to buffer" -> "write
to socket" approach?

Thank you for your support.

Ruben

-- 
Ruben Fonseca <rubenfonseca di uminho pt>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]