SuperSocket get Session by SessionID

As mentioned earlier, if you obtain a Session instance is connected, you can "Send ()" method for transmitting data to the client. However, in some cases, you can not get direct Session instances.

SuperSocket provides an API to let you AppServer from the container to obtain Session Session by SessionID

var session = appServer.GetSessionByID(sessionID);

 

if(session != null)

    session.Send(data, 0, data.Length);

What SessionID that?

SessionID AppSession class is a property used to uniquely identify a Session instance. In a SuperSocket TCP server, when a Session is created, SessionID will be assigned to a GUID string. If you do not SuperSocket UDP server using UdpRequestInfo, SessionID will have the client's IP and ports. If you use UdpRequestInfo, SessionID from the client will pass over.

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11126848.html