Click here to Skip to main content
12,951,289 members (48,664 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


39 bookmarked
Posted 21 Nov 2012

LiteCode - Remotely call methods over the network

, 21 Nov 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
Remotely invoke methods over the internet super easy


You are having enough of crackers, reverse engineers? With LiteCode you can host your code remotely at a server where no cracker can touch it. Your source code will become even more private than ever with more protection and no source code obfuscation required.


  • Using the SSP protocol for having a scalable server and having the traffic Encrypted/Compressed
  • Host your code where no cracker can ever touch it to get your software cracked
  • You don't need a lot of knowledge about networking how to send packets and such that is all being done in the background
  • Shared Classes is a new technique to remotely call methods in the client or server to make it easy for the end-user to understand what is going on in the code
  • Shared classes
  • System classes (under construction); currently there is Graphics, Cursor
  • Delegates (callback methods), example is shown below
  • Supports properties, overloaded methods
  • Call methods over the UDP protocol using the attribute UdpMethod
  • The NoWait attribute will not wait till the other side completed the method and does not wait till the packet is being sent
  • The PacketQueue attribute will use the PacketQueue from SSP, could increase performance 

What happens in the background 

A dummy class is being created in the background used to inject code but that's not important. Code is being injected in the dummy class so that you're able to call method's at the server/client side. The code from the server/client side will never leave or is sent to the server/client side. The most important part here is that the server contains all the sensitive information and the client does not. The injected code in the dummy class will only say to the server/client, call this method for me and if you can return the result. This way both sides can never inject each other with possible malicious code.

If people are interested in the code injection here you go:

internal class DynamicClassCreator
    static object Locky = new object();
    internal static SortedList<string, Type>

Using the code

Server sided:

namespace Server
    class Program
        static void Main(string[] args)
            //start the server at port 1234 using TCP and UDP
            LiteServer server = new LiteServer(1234, "", 
                                      NetworkProtocol.TCP | NetworkProtocol.UDP);
            server.onClientConnect += (Client client) =>
                ITest test = client.GetSharedClass<ITest>("test");
                //get the class from the client, client shared a class called "test"

                test.TestDelegate(":O", new TestDel((string val) =>
                //very simple just call the method and give as argument a delegate
                    //whenever this delegate is called, the client side invoked the delegate
                    Console.WriteLine("Message from client: " + val);
            Console.WriteLine("Providing remote code at port 1234");

Client side:

namespace Client
    class Program
        static void Main(string[] args)
        //connect to the server at ip at port 1234
            LiteClient client = new LiteClient("", 1234, 
              SecureSocketProtocol.NetworkProtocol.TCP | 
              SecureSocketProtocol.NetworkProtocol.UDP, null, null,
            (LiteClient c) => 
                //this delegate is being called before we
                //connected so the server can grab this shared class
                c.ShareClass("test", typeof(Dummy_Testy));
                //share a class with the name "test"
            }, (LiteClient c) =>

    public class Dummy_Testy : ITest
        public string TestMe()
            return "This is a message from the client";

        public void TestDelegate(string SomeValue, 
           [UdpMethod] [UncheckedRemoteExecution] TestDel CallMe)
                CallMe("some string from Client Side :)");

public delegate void TestDel(string ar);
public interface ITest
  string TestMe();
  void TestDelegate(string test, TestDel CallMe);

This is just a very basic server/client as you can see when the client is connected to the server. The server is now able to call two methods, TestMe and TestDelegate. You can see when the server calls TestMe(); it will return "This is a message from the client". And if the server calls TestDelegate and gives a delegate with it the client will be able to call. The method the server gave in that example will just keep calling the delegate in a while(true).

Points of interest

The interest I had to code this library was to make networking super easy for anyone for new and advanced users. Even myself if I had to make a program used in networking I would use my LiteCode library. Just because it's too easy to setup a secure connection and calling methods and communicating synchronized with the client/server. I also was becoming lazy of using the... SendPacket(...) and after that Receive(...) for an answer. What if the program was doing like 10 things at the same time, you might receive a different packet than you expected? In LiteCode it's so easy you just call the method and give it a delegate so it can return whatever value.



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

You may also be interested in...

Comments and Discussions

QuestionWhat's wrong with WCF for calling the server to do something? Pin
Maxim Novak26-Nov-12 22:30
memberMaxim Novak26-Nov-12 22:30 
Questiongood work buddy :D Pin
salmoneus21-Nov-12 8:16
membersalmoneus21-Nov-12 8:16 
GeneralMy vote of 5 Pin
soulprovidergr21-Nov-12 5:04
membersoulprovidergr21-Nov-12 5:04 
GeneralGood Pin
HoshiKata21-Nov-12 3:15
memberHoshiKata21-Nov-12 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170525.1 | Last Updated 21 Nov 2012
Article Copyright 2012 by Drag0nHunter
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid