I'm setting up a new client-server-network with SuperSocket and can't connenct an AppSession
to the server.
I found this question and tried it for my program.
The server is running fine, but at the moment I can only connect with the 'AsynTcpSession'. When I check the connected sessions it is shown as an 'AppSession' at the server. I want to use 'AppSession', because you can give them custom parameter.
My created AppSession:
public class MyAppSession : AppSession<MyAppSession, MyRequestInfo>
{
// those parameter
public int ClientKey { get; set; }
public string HashKey { get; set; }
}
Server:
MyAppServer _server = new MyAppServer();
ServerConfig _socketServerConfig = new ServerConfig { ReceiveBufferSize = 5000, MaxRequestLength = 5000, Name = "Test- Server", SendingQueueSize = 5000, ServerType = "MyAppServer", Port = 6000};
if (_server.Setup(_socketServerConfig))
{
DoStuff();
}
Client:
ClientSession _gateway = new AsyncTcpSession();
_gateway.Connect(6000);
On receiving telegram from Client:
private void ReceivedDataFromClient(MyAppSession session, MyRequestInfo requestinfo)
{
// session.SocketSession contains the Client AsynTcpSession
}
EDIT:
The AppSession
has an void Initialize(IAppServer<TAppSession, TRequestInfo> appServer, ISocketSession socketSession)
-Function. How do I use it? The session only knows the server ip and port.