Re: TCP out of band data and read()



In article <f7526c$pcn$1@xxxxxxxxxxxxxxxxxxxxx>,
Rainer Temme <Rainer_Temme@xxxxxxxxxxxxxxxxxxxxxx> wrote:

If an application is using read() instead of recv() on a TCP socket ,
what happens if some out of band data is sent? Does read() just read
it in as normal data or is it stored away elsewhere and only be
recovered using one of the recv*() functions?

To my knowledge, TCP has no mechanism to transport
"out-of-band" data.

TCP has an "urgent-mode" that is, a part ot the
transmitted data can be marked as urgent. The
reaction on the arrival of such data is depending on
the receiving process. It can ...

True, but the sockets API automatically treats the byte that the urgent
pointer points to as OOB data.


... read all data before the urgent data and store it for later
processing ... read and process the urgent data ... process
the stored data ... continue with normal processing

Which is what the sockets API does.

... read and drop all data before the urgent data ...
process the urgent data ... continue with normal
processing

AFAIK, the sockets API doesn't provide any way for an application to do
this, because you don't get access to the urgent pointer itself.

... ignore the fact that some data is urgent completely
and just treat all data as normal.

But the process cannot read the urgent-data out of sequence.

The OP's question was: what happens to the byte that the urgent pointer
points to if you use the standard Unix stream API (i.e. read()) rather
than the sockets API (recv()).

--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.



Relevant Pages

  • Re: commit 64ff3b938ec6782e6585a83d5459b98b0c3f6eb8 breaks rlogin
    ... Our TCP stack does not set the urgent flag if the urgent pointer ... Our current behaviour may in fact delay the urgent notification ...
    (Linux-Kernel)
  • Re: FTP Error 426
    ... TCP also provides a means to communicate to the receiver of data that at some point further along in the data stream than the receiver is currently reading there is urgent data. ... correct description is "command" not "subcommand", specifically an "FTP service command", see section 4.1.3. ...
    (bit.listserv.ibm-main)
  • Re: TCP Urgent Pointer Usage
    ... the byte indicated by the urgent pointer field in the packet is ... existence of a single byte of OOB data within the TCP data stream. ... The urgent pointer is a positive offset from ...
    (microsoft.public.dotnet.general)
  • Re: commit 64ff3b938ec6782e6585a83d5459b98b0c3f6eb8 breaks rlogin
    ... Our TCP stack does not set the urgent flag if the urgent pointer ... Our current behaviour may in fact delay the urgent notification ...
    (Linux-Kernel)
  • throughtput detector in linux or window
    ... I would like to test my TCP, UDP, RTP date rate ... It is very urgent. ...
    (comp.os.linux.networking)