コード例 #1
0
        private void _socket_ConnectionReceived(Socket newSocket)
        {
            var socketConnection = new NKC_SocketTCP(newSocket, this);

            connections.Add(socketConnection);
            _emitConnection(socketConnection);
            socketConnection._receiveData();
        }
コード例 #2
0
        private void _socket_ConnectionReceived(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args)
        {
            var socketConnection = new NKC_SocketTCP(args.Socket, this);

            connections.Add(socketConnection);
            // args.Socket.setDelegate(socketConnection, delegateQueue: NKScriptChannel.defaultQueue

            _emitConnection(socketConnection);
            var _ = socketConnection._receiveData();
        }
コード例 #3
0
        public void close()
        {
            if (_socket != null)
            {
                _socket.Dispose();
            }

            if (_server != null)
            {
                _server.close();
            }

            _socket = null;
            _server = null;
        }
コード例 #4
0
        public async static Task addCorePlatform(NKScriptContext context, Dictionary <string, object> options)
        {
            entryType = (System.Type)options["NKS.Entry"];


            // PROCESS SHOULD BE FIRST CORE PLATFORM PLUGIN
            await NKC_Process.attachToContext(context, options);

            // LOAD REMAINING CORE PLATFORM PLUGINS
            await NKC_FileSystem.attachToContext(context, options);

            //      await NKC_Console.attachToContext(context, options);
            await NKC_Crypto.attachToContext(context, options);

            await NKC_SocketTCP.attachToContext(context, options);

            await NKC_SocketUDP.attachToContext(context, options);

            await NKC_Timer.attachToContext(context, options);
        }
コード例 #5
0
 public NKC_SocketTCP(Socket socket, NKC_SocketTCP server)
 {
     _socket = socket;
     _server = server;
 }
コード例 #6
0
 private void _emitConnection(NKC_SocketTCP tcp)
 {
     this.getNKScriptValue().invokeMethod("emit", new object[] { "connection", tcp });
 }
コード例 #7
0
        // private methods

        private void _connectionDidClose(NKC_SocketTCP socketConnection)
        {
            this.connections.Remove(socketConnection);
        }
コード例 #8
0
 public NKC_SocketTCP(StreamSocket socket, NKC_SocketTCP server)
 {
     _socket = socket;
     _server = server;
 }
コード例 #9
0
        private void _emitConnection(NKC_SocketTCP tcp)
        {
            var js = this.getNKScriptValue();

           js.invokeMethod("emit", new object[] { "connection", tcp });
        }
コード例 #10
0
        // private methods

        private void _connectionDidClose(NKC_SocketTCP socketConnection)
        {
            this.connections.Remove(socketConnection);
        }
コード例 #11
0
        private void _socket_ConnectionReceived(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args)
        {
            var socketConnection = new NKC_SocketTCP(args.Socket, this);
            connections.Add(socketConnection);
            // args.Socket.setDelegate(socketConnection, delegateQueue: NKScriptChannel.defaultQueue

            _emitConnection(socketConnection);
            var _ = socketConnection._receiveData();
        }
コード例 #12
0
        public void close()
        {
            if (_socketListener != null)
                _socketListener.Dispose();

            if (_socket != null)
                _socket.Dispose();

            if (_server != null)
                _server.close();

            _socketListener = null;
            _socket = null;
            _server = null;
        }