Return value of 1000000 from recv.. why?

T

Tim Shephard

I've searched through my code. .. as far as I can see I am only
sending 12 bytes but recv is returning 1000000 bytes. Can anyone
provide me with any insight as to why this is?

Cheers,

Tim.
 
G

Geoff

I've searched through my code. .. as far as I can see I am only
sending 12 bytes but recv is returning 1000000 bytes. Can anyone
provide me with any insight as to why this is?

One can only guess. Post a complete, small sample of code that replicates the
problem and you might discover the answer yourself making it unnecessary to
guess blindly.
 
L

Lew Pitcher

I've searched through my code. .. as far as I can see I am only
sending 12 bytes but recv is returning 1000000 bytes.   Can anyone
provide me with any insight as to why this is?


1) Show us your code. Your verbal description is way too vague to be
of any assistance in determining what went wrong.

2) recv() isn't a standard C function; you might get better help from
a forum which addresses POSIX functions (a forum dedicated to your
execution platform would probably be the best bet).

3) (OFF TOPIC) Remember that TCP is an /octet-oriented stream/
protocol; the receiver will receive all the data, octet-by-octet, in
the order you sent it, *but* there is no guarantee that the receiver
will receive that data in the same "bundles" as you sent it. You may
send 10 bundles of 12 characters each, and the receiver can
legitimately receive 5 bundles of 24 characters, or even 1 bundle of
120 characters.

4) (OFF TOPIC) Remember that UDP is an all-or-nothing, unassured
delivery packet protocol, with a maximum packet size (in TCP/IP v4) of
64Kbytes. The receiver /cannot/ receive more than 64Kb at one time
(nor can the sender /send/ more than 64Kb at a time), so if the
receiver reports more than 64Kb received, then it is likely that the
receiver has a logic error.

Find the proper forum for your problem.
Post your code (the smallest code that exhibits the aberrant
behaviour). Show your results.

Then, your audience can help you
 
S

Seebs

I've searched through my code. .. as far as I can see I am only
sending 12 bytes but recv is returning 1000000 bytes. Can anyone
provide me with any insight as to why this is?

Try a Unix newsgroup? There's no recv() in standard C. And the answer
to your question most likely depends a lot on Unix, and very little on
C -- if you were using perl or Ruby or something, you'd probably see
the same results.

-s
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top