Sending/Receiving Data from a single command

May 23, 2014 at 9:13 PM
Hey everyone,

I was wondering if it is possible to send some bytes out to an external device, and then wait for the response all within one single command.

The primary reason for this is to create this workflow:

Call: byte[] captureData(sessionID)
captureData: sends packet with request to session with sessionID, blocks waiting for response.
captureData: returns byte[] array with data returned from packet request.
Returns: byte[]

This is running as an asynchronous tcp socket, with over 1000+ sessions, we can block the single session to allow for the external device to return data, but can not block the rest of the sessions.

Thanks, for any and all help!
May 27, 2014 at 8:15 AM
Please don't do any action like wait... it is performance killer.
Please decouple the request and response and design an asynchronous solution for your problem.
May 27, 2014 at 12:19 PM
Hey Kerry,

Thanks for the response, unfortunately, this function needs to be done synchronously, as the devices are legacy, and the client code is legacy as well.

Is it possible to access the underlying socket, and send/receive data directly that way, for a single function, while the rest remain asynchronous?
May 27, 2014 at 3:14 PM
What do you mean "legacy"? If you want to use SuperSocket, you must handle message async. Or you don't need to use it.

On the other hand, it doesn't require any code change in your client. Sync or Async is the mode how operate the data, and it has no relationship with data transferring in the channel and the remote endpoint of the network.

So I completely cannot agree with you.
May 28, 2014 at 5:50 PM
Hey Kerry,

Turns out the devices support basic asynchronous patterns (Callbacks) so I used them.