LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-25-2004, 05:27 PM   #1
abdobl
LQ Newbie
 
Registered: Sep 2004
Location: Tripoli
Posts: 22

Rep: Reputation: 15
Lightbulb I need same help


Hi All
I working in my project and I have same problem it to complicated to explain , but I will explain it in small Example :-
I use 2 computer run linux Red Hat 9 connected by using cross over link (client/server)
I need tow transfer huge data by using socket interface(with c)

My problem in the data was receive at client (recv function) the out put recive from buffer[0] to buffer[361] is OK after that the output of buffer[362-->50000] is 0
If any one has had a similar experience with this please tell me in detail
thank you
 
Old 09-27-2004, 01:12 PM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
recv() will read any data that there is to be read, and set its return value to the amount of data that has been read, in bytes. There is no guarentee that all of the data will be read at once (although you can modify the behaviour by changing the socket's file-descriptor flags with select()). You can also try the MSG_WAITALL flag to recv() but that still doesn't guarentee getting all of the data at once.

If an error has occurred, read() will set errno to the value of the error. You can test for errors with: (remember to use #include<errno.h> and #include<string.h>)
Code:
errno = 0;
if (len > recv(from,buffer,len,MSG_WAITALL)) {
   printf("Error: %s\n", strerror(errno);
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration