views:

18

answers:

2

I went searching for this and found at least one person who asked but got no answer. I think there is a need to start a send and receive segment (part of a larger process on same socket connection) and expect that there is nothing already in the receive buffer.

I saw no answer but did think of this kludge before I myself realized another way around it that seemed cleaner (read to "ends with" on the next segment). Simply set the RecieveTimeout to 1 or, if you think the sender is still in the process of sending, some slightly larger value. Then just call Receive with socketflags = 0 and discard the results.

Does anyone have a better way?

A: 

What is the origin of this requirement? Do you really have a need to throw data away?

EJP
A: 

I thought I did at the time but then just read and cached the results and then removed from cache instead. I'm searching for different result sequences (strings) that come about when sending a command. The next command sent can't assume that there are no longer any chars in the receive buffer since the protocol "standard" specifies that a response may end with a CR or LF or CRLF or LFCR or nothing. This protocol is implemented differently by different organizations since it is so loosely defined.

BillJam