Re: TCP read

From: Shawn Bayern (shawn.bayern@yale.edu)
Date: Thu Mar 30 2000 - 21:35:58 EST


On Thu, 30 Mar 2000, Sasha Peter Oblak wrote:

> How does one read a tcp message without sending a reply? In other
> words, if one has a tcp socket open, is it possible to call read, recv,
> recvfrom, recvmsg, or any other call without sending a reply message
> back?

Sorry, the question's not clear to me, so bear with me. Are you asking,
"How do I read from a socket without sending back an acknowledgement to
the sender?" If so, wouldn't that be a clear abstraction violation? Why
is the socket TCP if you don't want an acknowldgement to be sent back?

Furthermore, if that's what you're asking, keep in mind that it's not
recv() (or friends) that send the ACK back, or handle retries; the
illusion of a connection is maintained by the stack itself.

Now, if you're just asking, "Can I write a program where the 'user' data
flows one way, at least temporarily?" then the answer is "Sure, why not!",
except that I can't imagine you'd want to keep it up for too long without
some indication of what's going on on the other end. (If you do, it feels
more like a UDP application anyway, so why use TCP?) If you're running
into a problem, it's your program logic, not the mechanics of send() or
recv(), that are causing trouble. That is, you're blocking on a recv() on
the other side (or something similar), which is what apparently
necessitates the send(). There's no external requirement that messages be
paired.

Did that cover it? :)

Shawn



This archive was generated by hypermail 2b29 : Wed Apr 27 2005 - 03:30:03 EDT