https://github.com/banyc/socketapp
A Simple-to-use, Interactive Socket. Cross-platform. Middlewares for socket message processing.
https://github.com/banyc/socketapp
cross-platform csharp dotnet network oop socket tcp
Last synced: 12 months ago
JSON representation
A Simple-to-use, Interactive Socket. Cross-platform. Middlewares for socket message processing.
- Host: GitHub
- URL: https://github.com/banyc/socketapp
- Owner: Banyc
- License: mit
- Created: 2020-01-14T02:53:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-07T06:17:30.000Z (over 5 years ago)
- Last Synced: 2025-04-02T19:03:52.220Z (about 1 year ago)
- Topics: cross-platform, csharp, dotnet, network, oop, socket, tcp
- Language: C#
- Homepage:
- Size: 177 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SocketApp
A simple interactive socket. Cross-platform.
## Features
- Console app. Cross-platform.
- Build the host and the client at the same time
- Easy to setup a new Socket experiment
- Including additional network layers on top of the transport layer. Learn more from [`SocketApp.ProtocolStack`](src/SocketApp.ProtocolStack).
## Notice
The following instructions presumes `pwd` to be [`src/SocketApp.Hybrid`](src/SocketApp.Hybrid)
## Run
- download dotnet SDK
- set pwd to [the same directory as `.csproj` in](src/SocketApp.Hybrid)
- run `dotnet run`
## Customization
Reaction for some events is defined in class `Responser`. Those Events are
- On data (byte[]) has passed down to the bottom of the protocol stack and is ready to send
- On data has been delivered up to the top of the protocol stack and is ready for APP to consume
- On Accept() has done
- On Connect() has done
- On Receiving new message (which has not been processed by the protocol stack yet)
- On Socket is about to shutdown
To Modify the protocol stack, goto method `GetDefaultStack` in `DefaultProtocolFactory` as an example.
To build a new layer of protocol, derive your class from `IProtocol`.
To register your protocols, build your own protocol factory deriving from `IProtocolFactory`, and pass it as a parameter to `BeginBuildTcp()` from class `SockController`
## TODO
- [x] Deport `ProtocolStack` to an independent project.
- [ ] Support UDP
- [ ] SocketApp Hosts a Http Proxy Server
- [ ] Big file transportation protocol
- [ ] replace callback mechanism with async