Skip to content

MarvinDrude/MNetworkLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MNetworkLib

Network Library I'm working on in my free time

Example Usage

class Program {

        static void Main(string[] args) {

            Logger.AddDefaultConsoleLogging();

            TCPServer server = new TCPServer();
            
            server.OnMessage += (cl, me) => {

                Logger.Write("TEST", cl.UID + ": " + me.ToStringContent());

                cl.Send(new TCPMessage() {
                    Content = Encoding.UTF8.GetBytes("This is a message from the server")
                });

            };

            server.Start();

            TCPClient client = new TCPClient("192.168.2.113", logging: false);

            client.OnHandshake += () => {
                client.Send(new TCPMessage() {
                    Content = Encoding.UTF8.GetBytes("This is a test")
                });
            };

            client.OnMessage += (me) => {

                Logger.Write("TEST", "Server: " + me.ToStringContent());

            };

            client.Connect();

        }

    }

Example Logger Output:

Image not found

About

Network Library I'm working on in my free time

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages