We have an application where it would useful to be able to inspect a Socket after it is accepted, but before any other operations happen on it, in order to determine whether we want to marshal it over to another process to handle.
Currently this is not possible because once accepted in SocketConnectionListener, a Socket is almost immediately wrapped up in a ConnectionContext and read from.
It is important for us to inspect a Socket immediately, as (on Windows) once asynchronous I/O beings moving a Socket to another process will fail (see DuplicateAndClose).
Describe the solution you'd like
Ideally a new option is added to SocketTransportOptions which, similar to CreateBoundListenSocket, allows customizing this Socket-y operation. I'll have a PR sketching this out up shortly. #34345
We have an application where it would useful to be able to inspect a
Socketafter it is accepted, but before any other operations happen on it, in order to determine whether we want to marshal it over to another process to handle.Currently this is not possible because once accepted in
SocketConnectionListener, aSocketis almost immediately wrapped up in aConnectionContextand read from.It is important for us to inspect a
Socketimmediately, as (on Windows) once asynchronous I/O beings moving aSocketto another process will fail (see DuplicateAndClose).Describe the solution you'd like
Ideally a new option is added to
SocketTransportOptionswhich, similar toCreateBoundListenSocket, allows customizing thisSocket-y operation.I'll have a PR sketching this out up shortly.#34345