Application.send C# (CSharp) Method

send() public method

public send ( string keys ) : int
keys string
return int
    public unsafe int send(string keys)
    {
        System.Console.WriteLine(keys);
        return 0;
    }

Usage Example

Example #1
0
        /// <summary>
        /// Close the connection with the client
        /// Call 'connectionClosed' of your application that extends the DKService when the connection is closed successfully
        /// </summary>
        public void Close()
        {
            // one thread per time, prevent two or more thread call Close() in same time and generate duplicate notifications
            lock (ThreadLocker.sync("Client::Close"))
            {
                if (!Connected)
                {
                    return;
                }

                try
                {                 // sets connected false
                    Connected = false;
                    // remove the client from signal
                    ClientSignal.Remove(Id);
                    // close the socket
                    _client.Close();
                }
                catch (Exception ex)
                {
                    Log.Write("Error when disconnect client " + ex.Message + " - " + ex.StackTrace, LogLevel.ERROR);
                }
                finally
                {
                    // if the socket have a type and defined, notification the application is desconnected
                    if (socketLayer != SocketLayer.undefined)
                    {
                        Application.send(ApplicationSend.connectionClosed, new object[] { this });
                        socketLayer = SocketLayer.undefined;
                    }
                }
            }
        }