Results 1 to 1 of 1
Hello,
I'm trying to save the incoming data of a udp transmission to a file. To avoid unnecessary overhead I want to use splice.
int sock;
//(...) socket initialization
FILE ...
- 02-15-2011 #1Just Joined!
- Join Date
- Feb 2011
- Posts
- 1
Splice from UDP-socket to file?
Hello,
I'm trying to save the incoming data of a udp transmission to a file. To avoid unnecessary overhead I want to use splice.
int sock;
//(...) socket initialization
FILE *myfile;
int mypipe[2];
if((myfile = fopen("test.txt","w"))== NULL){return;}
if(pipe(mypipe)<0){return;}
splice(sock, NULL, mypipe[1], NULL, buffersize, SPLICE_F_MOVE);
splice(mypipe[0], NULL, fileno(myfile), NULL, buffersize, SPLICE_F_MOVE);
Already the first call of splice ends with EINVAL.
Does anyone see what I'm doing wrong or isn't it possible to use splice on sockets?
I'm using Ubuntu 9.10, Kernel 2.6.31-22
Thank you very much in advance


Reply With Quote