[erlang-questions] socket unrecv

Benoit Chesneau <>
Sat Jun 9 16:13:28 CEST 2012


gen_tcp has the undocumented function `unrecv/2` which is using
`inet(6)_tcp:unrecv/2` but I don't see the equivalent in the SSL
module.

Is there any way in the standard library to fill a buffer in the socket ?

My use case is the following: I have an api that read some data from
the socket then pase it and keeps the rest in a buffer. Now I want to
use this buffer with another API that only read from the socket. I
could of course make a change in this API to read the data from a
buffer if it`s available, but since I don't control this API it will
make some time to have this change included. So rather to say to
others to use my own patched API in between, I could use this trick.

So if there is a way to put back the data in the socket pid ?

- benoît



More information about the erlang-questions mailing list