vibe.d beta banner
get vibe.d
0.8.3

Asynchronous I/O that doesn’t get in your way, written in D

Function EventDriverSockets.adoptStream

Adopts an existing stream socket.

abstract Handle!("streamSocket",eventcore.driver.Handle!("socket",eventcore.driver.Handle!("fd",ulong,-1L).Handle,eventcore.driver.Handle!("fd",ulong,-1L).Handle(-1)).Handle,eventcore.driver.Handle!("socket",eventcore.driver.Handle!("fd",ulong,-1L).Handle,eventcore.driver.Handle!("fd",ulong,-1L).Handle(-1)).Handle((-1))) adoptStream (
  int socket
) nothrow @safe;

The given socket must be in a connected state. It will be automatically switched to non-blocking mode if necessary. Beware that this may have side effects in other code that uses the socket and assumes blocking operations.

Parameters

NameDescription
socket Socket file descriptor to adopt

Returns

Returns a socket handle corresponding to the passed socket descriptor. If the same file descriptor is already registered, StreamSocketFD.invalid will be returned instead.

Authors
Copyright
License