Send to another session from within a command

Sep 10, 2013 at 3:33 AM
Edited Sep 10, 2013 at 3:33 AM
Hi Kerry,
Thanks for a great project.
I'm having an issue when trying to send to another session from within ExecuteCommand.

This is the gist of my code:
public override void ExecuteCommand(CustomSession session, CustomRequestInfo requestInfo)
{

var remotesession = session.AppServer.GetAppSessionByID(requestInfo.RemoteID);

remotesession.send("Test");

}
The CustomRequestInfo.RemoteID is a valid GUID for the session.AppServer, and the remotesession states it is connected.

The remotesession.send completes and stepping into the code the command gets queued, but never gets sent.

Any thoughts?

Thanks,
-Darien
Coordinator
Sep 10, 2013 at 4:15 AM
Which version are you using? You can get the version number from the assembly property.

Sent from my Windows Phone

From: darienford
Sent: 9/9/2013 22:33
To: [email removed]
Subject: Send to another session from within a command [SuperSocket:456301]

From: darienford

Hi Jerry,
Thanks for a great project.
I'm having an issue when trying to send to another session from within ExecuteCommand.

This is the gist of my code:
public override void ExecuteCommand(CustomSession session, CustomRequestInfo requestInfo)
{

var remotesession = session.AppServer.GetAppSessionByID(requestInfo.RemoteID);

remotesession.send("Test");

}
The CustomRequestInfo.RemoteID is a valid GUID for the session.AppServer, and the remotesession states it is connected.

The remotesession.send completes and stepping into the code the command gets queued, but never gets sent.

Any thoughts?

Thanks,
-Darien
Sep 10, 2013 at 5:00 PM
Hi Jerry,
I'm using 1.6 which I downloaded 4 days ago. (I am not on the PC where I am doing development currently).

Thanks,
-Darien
Coordinator
Sep 10, 2013 at 5:14 PM
How do you know the data didn't reach?
Sep 10, 2013 at 7:05 PM
I have a break point set on the NewRequestReceived event and also in the command I am expecting.
Additionally, if I send the command again, and step into the send, it goes to the queue and you can see the still queued other messages.
Coordinator
Sep 10, 2013 at 7:12 PM
NewRequestReceived event? In your client side? What client do you use?
Sep 11, 2013 at 12:49 AM
Let me provide a little more information:

I have a server and multiple clients.
The clients use active connect with a supersocket to connect to the server. Client A sends a command which is to be sent to Client B. In the execute command on the server, we access the second session and call Send(); which does not actually send the data.

Hopefully this image will help explain the situation.

Image
Coordinator
Sep 11, 2013 at 1:12 AM
Do you mean you use SuperSocket ClientEngine in your clients? If so which application protocol are you using (over tcp)?

Sent from my Windows Phone

From: darienford
Sent: 9/10/2013 19:49
To: [email removed]
Subject: Re: Send to another session from within a command [SuperSocket:456301]

From: darienford

Let me provide a little more information:

I have a server and multiple clients.
The clients use active connect with a supersocket to connect to the server. Client A sends a command which is to be sent to Client B. In the execute command on the server, we access the second session and call Send(); which does not actually send the data.

Hopefully this image will help explain the situation.

Image
Sep 11, 2013 at 1:32 AM
No, I am using a custom supersocket AppServer on the client, with custom protocol, custom filter, custom session, custom request info, and custom commands.

The communication from client to the server works without an issue. The communication back to the same client from the server works as well.

The issue only manifests when trying to send to a different session when currently executing a command from another session.
public class CustomCommand :  CommandBase<CustomSession, CustomInfo>
    {

        public override void ExecuteCommand(CustomSession session, CustomInfo requestInfo)
        {
            //This is successful. We acquire the session to send to
            var remotesession = session.AppServer.GetAppSessionByID(requestInfo.SendTo);
            
            //This puts the data on a queue to send which never gets sent.
            remotesession.Send(requestInfo.Body);

        }
    }
Coordinator
Sep 11, 2013 at 2:56 AM
Could you tell me what protocols (over TCP) are used in these three SuperSocket instances?
Sep 11, 2013 at 12:37 PM
The CustomCommand object expects a fixed header with length and binary data. Is that what you are asking?
The same is expected on the client.

More accurately it is like this:
public class CustomCommand :  CommandBase<CustomSession, CustomInfo>
    {

        public override void ExecuteCommand(CustomSession session, CustomInfo requestInfo)
        {
            //This is successful. We acquire the session to send to
            var remotesession = session.AppServer.GetAppSessionByID(requestInfo.SendTo);
            
            byte[] datapacket = GenerateCommandPacket(requestInfo.Body);
            //This puts the data on a queue to send which never gets sent.
            remotesession.Send(datapacket, 0, datapacket.length);

        }
    }
Coordinator
Sep 11, 2013 at 2:19 PM
Could you write a NUnit/MSTest project which can produce this issue? If you can, please send it to me, then I can produce it in my local and fix the issue if it does exist.