niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » Linux » networking
socket read modifies third parameter after the call: Very strange
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
jainarunk@gmail.com
*nix forums beginner


Joined: 10 May 2006
Posts: 18

PostPosted: Thu Jul 20, 2006 3:47 pm    Post subject: socket read modifies third parameter after the call: Very strange Reply with 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
Back to top
Robert Harris
*nix forums Guru Wannabe


Joined: 03 Mar 2005
Posts: 118

PostPosted: Thu Jul 20, 2006 9:15 pm    Post subject: Re: socket read modifies third parameter after the call: Very strange Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Mon Dec 01, 2008 9:14 pm | All times are GMT
navigation Forum index » *nix » Linux » networking
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Postfix + MySQL error: very strange variable %s iWarior Postfix 0 Mon Aug 25, 2008 2:01 pm
No new posts Arbitrary function with parameter darknails@gmail.com C++ 2 Fri Jul 21, 2006 9:58 am
No new posts Strange problem with Sequence.. please help.. Krist Server 4 Fri Jul 21, 2006 7:30 am
No new posts can I call a internal function directly? minrobin@gmail.com shell 2 Fri Jul 21, 2006 2:17 am
No new posts VERY strange C anomaly Bernard Liang C 9 Thu Jul 20, 2006 9:32 pm

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
[ Time: 0.1873s ][ Queries: 16 (0.1168s) ][ GZIP on - Debug on ]