10000 GitHub - ratanparai/SimpleSocket: Simple Async Socket library for dotnet core
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ratanparai/SimpleSocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SimpleSocket

Install:

To install SimpleSocket, run the following command in the Package Manager Console

PM> Install-Package Ratan.SimpleSocket

Example:

using System;
using SimpleSocket.Async;

namespace PlayGround
{
    class SocketServerTest : ServerServiceAsync
    {
        public SocketServerTest() : base(2524)
        {
        }

        public override void OnMessageReceive(SimpleSocketData data)
        {
            Console.WriteLine(data.Message);

            data.Message = "\n" +  data.Message.Length + " is the length of the message and the message was : " + data.Message + "\n";

            SendMessage(data);
        }

        public override void OnClientDisconnected()
        {
            Console.WriteLine("Total number of connected clients : " + ConnectedClients);
        }


    }

Test run the socket from console app -

using System;
using System.Net;

namespace PlayGround
{
    class Program
    {
        static void Main(string[] args)
        {
            SocketServerTest server = new SocketServerTest();
            Console.WriteLine("Server running");
            Console.ReadKey()
        }
}

About

Simple Async Socket library for dotnet core

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0