Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    SocketMessageLayer Class

    Namespace: Stride.Engine.Network
    Assembly: Stride.Engine.dll

    High-level layer that can be used on top of SimpleSocket to send and receive objects using serialization.

    System.Object → SocketMessageLayer
    Derived from SocketMessageLayer:

    public class SocketMessageLayer
    Name Description
    Constructors
    SocketMessageLayer(SimpleSocket, Boolean)
    Properties
    Context
    Methods
    AddPacketHandler<T>(Action<T>, Boolean)
    AddPacketHandler<T>(Func<T, Task>, Boolean)
    MessageLoop()
    Send(Object)
    SendReceiveAsync(SocketMessage)
    | Improve this Doc View Source

    Constructors


    SocketMessageLayer(SimpleSocket, Boolean)

    public SocketMessageLayer(SimpleSocket context, bool isServer)
    Parameters
    Type Name Description
    SimpleSocket context
    System.Boolean isServer
    | Improve this Doc View Source

    Properties


    Context

    public SimpleSocket Context { get; }
    Property Value
    Type Description
    SimpleSocket
    | Improve this Doc View Source

    Methods


    AddPacketHandler<T>(Action<T>, Boolean)

    public void AddPacketHandler<T>(Action<T> handler, bool oneTime = false)
    Parameters
    Type Name Description
    System.Action<T> handler
    System.Boolean oneTime
    Type Parameters
    Name Description
    T

    AddPacketHandler<T>(Func<T, Task>, Boolean)

    public void AddPacketHandler<T>(Func<T, Task> asyncHandler, bool oneTime = false)
    Parameters
    Type Name Description
    System.Func<T, System.Threading.Tasks.Task> asyncHandler
    System.Boolean oneTime
    Type Parameters
    Name Description
    T

    MessageLoop()

    public async Task MessageLoop()
    Returns
    Type Description
    System.Threading.Tasks.Task

    Send(Object)

    public async Task Send(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Threading.Tasks.Task

    SendReceiveAsync(SocketMessage)

    public async Task<SocketMessage> SendReceiveAsync(SocketMessage query)
    Parameters
    Type Name Description
    SocketMessage query
    Returns
    Type Description
    System.Threading.Tasks.Task<SocketMessage>

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation