Akka.IO.SocketChannel.Open C# (CSharp) Method

Open() public static method

public static Open ( ) : SocketChannel
return SocketChannel
        public static SocketChannel Open()
        {
            return new SocketChannel(new Socket(SocketType.Stream, ProtocolType.Tcp));
        }

Usage Example

Esempio n. 1
0
        public TcpOutgoingConnection(TcpExt tcp, IChannelRegistry channelRegistry, IActorRef commander, Tcp.Connect connect)
            : base(tcp, SocketChannel.Open().ConfigureBlocking(false), connect.PullMode)
        {
            _channelRegistry = channelRegistry;
            _commander       = commander;
            _connect         = connect;

            Context.Watch(commander);    // sign death pact

            connect.Options.ForEach(_ => _.BeforeConnect(Channel.Socket));
            if (connect.LocalAddress != null)
            {
                Channel.Socket.Bind(connect.LocalAddress);
            }
            channelRegistry.Register(Channel, SocketAsyncOperation.None, Self);
            if (connect.Timeout.HasValue)
            {
                Context.SetReceiveTimeout(connect.Timeout.Value);  //Initiate connection timeout if supplied
            }
        }