GithubHelp home page GithubHelp logo

oockeep / managedsockets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from umby24/managedsockets

0.0 1.0 0.0 31 KB

A simple, Asynchronous, event-driven TCP socket library for c#

License: MIT License

C# 100.00%

managedsockets's Introduction

Managed Sockets

Why?

I decided to write this after finding that existing sockets implementations did not meet my requirements.

My requirements:

  • Asyncrounous with no unnecessary threads
  • Event driven
  • Thread-safe
  • SIMPLE
  • Fast

Projects like DotNetty and ReactiveSockets are way too complicated, especially for smaller projects. Looking at the super old Winsock Orcas project (and a c# ported version of it), it was almost what I was looking for.. but still had some unnecessary complications.

So here you have it, Managed Sockets.

Due to my usages only being TCP at the moment, that is all this supports. If I need it in the future then I may add it then.

Usage

Server

Use a TcpListener, set on a BeginAcceptTcpClient callback. When a new client comes in from the TcpListener, create a new socket like so:

var socket = new ClientSocket();
socket.DataReceived += SocketOnDataReceived;
socket.Disconnected += SocketOnDisconnected;
socket.Accept([TcpClient]);

From here on out, Managed Sockets has your back. If data is received, your event will be called. If the client disconnects for whatever reason, your event will be called. (and if it was because of an error, you even get a reason!)

Client

Check out the included project called Viewer.

It's a simple winforms gui, currently setup to just show the output of whatever data gets received. It's setup for staying connected to IRC servers, so go ahead and throw an IRC Ip in there and try it out. It should serve as a super basic example of usage for client applications.

Licence

MIT

managedsockets's People

Contributors

umby24 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.