Is it possible to do this process flow within one super socket session?

May 22, 2014 at 9:46 AM
Edited May 23, 2014 at 7:30 AM
So here's the process flow:

1) External Device Sends System Recognized ID
2) SuperSocket Receives the ID, and 'links' the System ID to a unique SuperSocket Session
3) SuperSocketReceiverFitler goes to a Command
4) Command sends some data to external device
5) ExternalDevice responds with a 1 byte response indicating if data is correct
6) SuperSocket Receives Response
7) SuperSocketReceiverFilter goes to a different Command that will do some more internal processes that will use the System ID provided by the device in the beginning

So in my attempt to do this I extended my AppSession class like so:
namespace Foo
{
    using SuperSocket.SocketBase;
    using SuperSocket.SocketBase.Protocol;

    public class MySession : AppSession<MySession, BinaryRequestInfo>
    {
        public new MyServer AppServer
        {
            get { return (MyServer)base.AppServer; }
        }

        public string SystemRecognizedID { get; set; }
    }
}
As an external device connects to super socket by sending the System recognized ID. I assign the received ID to the session that is established.

I then use my ReceiverFilter to go to a Command that replies to the external device with something like: 'hey I received your message, here's some data'.

The external device then connects to the super socket server again and sends me a byte indicating if the data I sent to them was what they wanted.

But here's the part where I think it fails. After the device sends the response byte, it seems like a new session is created for that response. So the ID I associated with the first session that got created gets lost upon receiving a response message from the device.

Sometimes the whole process flow seems to work in one session, but in other times it doesn't. Is there a way for me to do everything in one session? Should I just extend the session time out (don't know how though)?

I'm using a TCP server, my supersocket version is 1.6.1

Thanks.

UPDATE:

Tried using these config values:
<server name="MyServer" serverTypeName="MyServerName"  maxConnectionNumber="10000" mode="Tcp" ip="Any" port="<number>" keepAliveTime="800" keepAliveInterval="400"></server>
Note my values for the keepAliveTime and keepAliveInterval. Connections still get closed though. It is worth noting though that we do the processflow twice and the connection drops upon the second time we start the flow.

UPDATE 2:

After setting the keepAliveTime and keepAliveInterval to both 5000 (just for kicks) it seems like the closing issue is no more. If this is NOT the proper way to do the process flow in one session please notify me.
Coordinator
May 27, 2014 at 8:11 AM
"But here's the part where I think it fails. After the device sends the response byte, it seems like a new session is created for that response. So the ID I associated with the first session that got created gets lost upon receiving a response message from the device."

The the client send the data to the server in one tcp connection, there will be only one session.
If you found the session is changed, that means the client create a new connection to connect the server.
May 27, 2014 at 10:22 AM
kerryjiang wrote:
"But here's the part where I think it fails. After the device sends the response byte, it seems like a new session is created for that response. So the ID I associated with the first session that got created gets lost upon receiving a response message from the device."

The the client send the data to the server in one tcp connection, there will be only one session.
If you found the session is changed, that means the client create a new connection to connect the server.
...or it could mean (as we found out) is that the session was closed because the keep alive interval was met, when we changed the value up to 5000 it looks like everything is being processed in one session. Thanks for your reply!