Quantcast

Problem with Session::send (const std::string& string)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem with Session::send (const std::string& string)

Wjack07
This post was updated on .
Hi:

I am trying to trim the latency of sending messages by using as less overhead as possible.
But I met some weird issues, and have no clue so far.
Hope anyone has any ideas.


Basically, instead of using FIX::Session::sendtotarget ( Message& message)

One can use  FIX::Session::send ( Message& message)*

*The SessionID needs to be set up first. this can be done separately. But once it is done, we can save this step for every to-be-sent message after (in QuickFIX, it checks the sesseionID every time when a message is sent, and this slows down a little bit.)

Furthermore, one can even use FIX::Session::sendRaw (Message& message)**
And this can further save few steps

**sendRaw in session.h is in "private" category, so the .h file needs to be modified a bit before using.


To push further, I tried FIX::Session::send ( const std::string& string )***

*** again, it is in "private category", so the .h file needs to be modified. Also the string should be well defined before head (for example, from message.ToString). The MegSeqNum issue also needs to be considered.

So far so good, and I did successfully send out the message by this way.
By using FIX::Session::send ( const std::string& string ), the latency for sending message is significantly reduced.

BUT, here is the problem.

if I do message.ToString > FIX::Session::send ( const std::string& string ),  then the message is sent successfully.
if I do message.ToString > modify this string (for example, COrderID from 12345 to 54321 by string.erase and then string insert)> FIX::Session::send ( const std::string& string ), the message will be written on the log file (or shown on the screen logger) saying it is outgoing, but the server never respond (not even reject), which suggests this message wasn't sent out.

What is interesting is, if I do
message.ToString > modify this string (COrderID from 12345 to 54321 by string.erase and then string.insert)> modify this string (COrderID from 54321 back to 12345) > FIX::Session::send ( const std::string& string )   then this one will be successful sent out.

This is very weird to me, and it seems the message.ToString automatically set up something, and the FIX::Session::send will check to see if message and message.ToString are matched.
I read those code, but didnt find such a thing. So I totally confused now.

Simply put, my question is,
why the modification after message.ToString makes FIX::Session::send ( const std::string& string ) failed?

Many thanks
Wjack

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with Session::send (const std::string& string)

Sev Zaslavsky
QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html
QuickFIX Support: http://www.quickfixengine.org/services.html

Regarding your experiment with modifying the output of message.ToString,
I think that once you modify the string, you'll invalidate the
CheckSum(10) field that QuickFix appends to the end of each message.

On 7/6/2014 5:30 AM, Wjack07 wrote:

> QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html
> QuickFIX Support: http://www.quickfixengine.org/services.html
>
> Hi:
>
> I am trying to trim the latency of sending message by using as less overhead
> as possible.
>
> But I met some weird issue, and have no clue so far. Hope anyone has some
> idea.
>
>
> Basically, instead of using FIX::Session::sendtotarget ( Message& message)
>
> One can use  FIX::Session::send ( Message& message)*
>
> *But the SessionID needs to be set up first. this can be done separately.
> But once it is done, we can save this step for every to-be-sent message
> after (in QuickFIX, it check the sesseionID every time when a message is to
> be sent, and this slows down a little bit.)
>
>
> Furthermore, one can even use FIX::Session::sendRaw (Message& message)**
> And this can further save few steps
>
> **sendRaw in session.h is in "private" category, so the .h file needs to be
> modified a bit before using.
>
>
> To push further, I tried FIX::Session::send ( const std::string& string )***
>
> *** again, it is in "private category" so the .h file needs to be modified.
> Also the string should be well defined before head (for example, from
> message.ToString). The MegSeqNum issue also needs to be considered.
>
> So far so good, and I did successfully send out the message by this way.
> By using FIX::Session::send ( const std::string& string ), the latency for
> sending message is significantly reduced.
>
> BUT, here is the problem.
>
> if I do message.ToString > FIX::Session::send ( const std::string& string ),
> then the message is sent successfully.
> if I do message.ToString > modify this string (for example, COrderID from
> 12345 to 54321)> FIX::Session::send ( const std::string& string ), the
> message will be written on the log file (or shown on the screen logger)
> saying it is outgoing, but the server would never respond, which suggesting
> this message want sent out.
>
> What is interesting is, if I do
> do message.ToString > modify this string (COrderID from 12345 to 54321 by
> string.erase and then string insert)> modify this string (COrderID from
> 54321 back to 12345) > FIX::Session::send ( const std::string& string )
> then this is successful.
>
> This is very weird to me, and it seems the message.ToString automatically
> set up some flag, and the FIX::Session::send will check that flag (to see if
> message and message.ToString are matched).
> I read hose code, but didnt find such a thing.
>
> So, my question is,
> why the modification after message.ToString makes FIX::Session::send ( const
> std::string& string ) failed?
>
> Many thanks
> Wjack
>
>
>
>
>
> --
> View this message in context: http://quickfix.13857.n7.nabble.com/Problem-with-Session-send-const-std-string-string-tp6646.html
> Sent from the QuickFIX - Dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> Quickfix-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quickfix-developers


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Quickfix-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfix-developers
Loading...