sendfile not working

Reply

Join Date: May 2009
Posts: 3
Reputation: lipee36 is an unknown quantity at this point 
Solved Threads: 0
lipee36 lipee36 is offline Offline
Newbie Poster

Re: How to send files through a socket connection?

 
0
  #1
May 11th, 2009
Hi, i'm having the same problem here... I have to send a xml file from a server and receive 16 bin files for answer..
I know how to send string and etc.. and tried to use sendfile() to send at least the xml file.. but it didn't work out... here's the code to send
  1. /*part of my client program*/
  2. FILE *fil = fopen("test.xml","r");
  3. sendfile(s1, fil, NULL, 255);

and here is what I receive in server

  1. FILE *f;
  2. rval = recv(s0, f, NULL, 255) ;
  3. while (!feof(f)) {
  4. fscanf (f, "%s", msg) ;
  5. printf("Teste: %s \n",msg);
  6. }

hope you can hel me whit ANYTHING!

thanks anyway.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,602
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: How to send files through a socket connection?

 
0
  #2
May 11th, 2009
EDIT: never mind, this has been moved to a new thread.

.
Last edited by jephthah; May 11th, 2009 at 12:24 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,625
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 714
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: sendfile not working

 
0
  #3
May 11th, 2009
Split into a new thread.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,602
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: sendfile not working

 
0
  #4
May 11th, 2009
you havent given much for us to go on here, as far as trying to help you debug your code.

i suspect you need to review the fundamentals of socket programming.

review Beej's Guide, review your code, and try again.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 3
Reputation: lipee36 is an unknown quantity at this point 
Solved Threads: 0
lipee36 lipee36 is offline Offline
Newbie Poster

Re: sendfile not working

 
0
  #5
May 12th, 2009
Sure I do! that's why I'm asking for help... I've never used sockets before.. so I'm learning how to.

I got how to switch messages, to work whit a slave and master and etc.. but I couldn't do thw files thing to work ok!
But thanks for the help.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 3
Reputation: lipee36 is an unknown quantity at this point 
Solved Threads: 0
lipee36 lipee36 is offline Offline
Newbie Poster

Re: sendfile not working

 
0
  #6
May 19th, 2009
OK I got how to send files to a server e it's doing everything that it's supposed to do!

But how can I get the results of it!?

Like a send to client from server now....
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,602
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 120
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: sendfile not working

 
0
  #7
May 19th, 2009
i've lost track of your original question, if i ever understood it to begin with.

post your client and your server program files and tell us what's not working the way you expect it to.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC