Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

SuperSocket/SuperSocket.SerialIO

Open more actions menu

Repository files navigation

SuperSocket.SerialIO

Join the chat at https://gitter.im/supersocket/community Build Status NuGet Version NuGet Download

Serial IO support for SuperSocket

The sample code below shows us how we build a serial IO communication server with SuperSocket.

var host = SuperSocketHostBuilder
    .Create<StringPackageInfo, CommandLinePipelineFilter>()
    .UsePackageHandler(async (s, package) =>
        {
            await s.SendAsync(Encoding.UTF8.GetBytes(package.ToString() + "\r\n"));
        })
    .ConfigureSuperSocket(options =>  
        {
            options.Name = "SIOServer";
            options.Listeners = new[] {
                new SerialIOListenOptions()
                {
                    PortName = "COM2",   // serial port name
                    BaudRate = 9600,  // baudRate of the serial port
                    Parity = Parity.None,
                    StopBits = StopBits.None,
                    Databits = 5;  // value limit 5 to 8
                }
            };
        })
    .UseSerialIO()
    .ConfigureLogging((hostCtx, loggingBuilder) => {
        loggingBuilder.AddConsole();
    }).Build();

You also can leave the infromation of Serial IO in the configuration.

{
    "serverOptions": {
        "name": "SIOServer",
        "listeners": [
            {
                "path": "sio://COM1/?BaudRate=9600&Parity=Odd&StopBits=2&Databits=7"
            }
        ]
    }
}

About

Serial IO support for SuperSocket

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.