|
|
|
|
|
|
| Author |
Message |
jainarunk@gmail.com *nix forums beginner
Joined: 10 May 2006
Posts: 18
|
Posted: Thu Jul 20, 2006 3:47 pm Post subject:
socket read modifies third parameter after the call: Very strange
|
|
|
Hello Group,
I am doing a socket read
char buf[2048];
int readLen = 2048;
cout<< "Readlen = " << readLen << endl; // Prints Readlen = 2048
read(sockfd, buf, readLen);
cout<< "Readlen = " << readLen << endl; // Prints Readlen = 28169
Can someone tell me what is going on. What went wrong. I am working
on Redhat Linux
platform.
Thx.
arun |
|
| Back to top |
|
 |
Robert Harris *nix forums Guru Wannabe
Joined: 03 Mar 2005
Posts: 118
|
Posted: Thu Jul 20, 2006 9:15 pm Post subject:
Re: socket read modifies third parameter after the call: Very strange
|
|
|
jainarunk@gmail.com wrote:
| Quote: | Hello Group,
I am doing a socket read
char buf[2048];
int readLen = 2048;
cout<< "Readlen = " << readLen << endl; // Prints Readlen = 2048
read(sockfd, buf, readLen);
cout<< "Readlen = " << readLen << endl; // Prints Readlen = 28169
Can someone tell me what is going on. What went wrong. I am working
on Redhat Linux
platform.
Thx.
arun
|
1. Make sure you #include <unistd.h>
2. Check the return value of your read() and, if it is -1, print out the
value of errno.
Robert |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Mon Dec 01, 2008 9:14 pm | All times are GMT
|
|
Hypnosis | Share Prices | Budapest | Xbox Mod Chips | Free Advertising
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|