TryCompleteAccept() публичный статический Метод

public static TryCompleteAccept ( SafeCloseSocket socket, byte socketAddress, int &socketAddressLen, IntPtr &acceptedFd, SocketError &errorCode ) : bool
socket SafeCloseSocket
socketAddress byte
socketAddressLen int
acceptedFd IntPtr
errorCode SocketError
Результат bool
Пример #1
0
            public static unsafe InnerSafeCloseSocket Accept(SafeCloseSocket socketHandle, byte[] socketAddress, ref int socketAddressLen, out SocketError errorCode)
            {
                int acceptedFd;

                if (!socketHandle.IsNonBlocking)
                {
                    errorCode = socketHandle.AsyncContext.Accept(socketAddress, ref socketAddressLen, -1, out acceptedFd);
                }
                else
                {
                    SocketPal.TryCompleteAccept(socketHandle, socketAddress, ref socketAddressLen, out acceptedFd, out errorCode);
                }

                var res = new InnerSafeCloseSocket();

                res.SetHandle((IntPtr)acceptedFd);
                return(res);
            }
            internal static unsafe InnerSafeCloseSocket Accept(SafeSocketHandle socketHandle, byte[] socketAddress, ref int socketAddressLen, out SocketError errorCode)
            {
                IntPtr acceptedFd;

                if (!socketHandle.IsNonBlocking)
                {
                    errorCode = socketHandle.AsyncContext.Accept(socketAddress, ref socketAddressLen, out acceptedFd);
                }
                else
                {
                    bool completed = SocketPal.TryCompleteAccept(socketHandle, socketAddress, ref socketAddressLen, out acceptedFd, out errorCode);
                    if (!completed)
                    {
                        errorCode = SocketError.WouldBlock;
                    }
                }

                var res = new InnerSafeCloseSocket();

                res.SetHandle(acceptedFd);
                return(res);
            }