|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Re: sendToTarget and "SessionNotFound" woes...QuickFIX Support: http://www.quickfixengine.org/services.html Same errors.
Apologies for the confusion, I was trying various combinations and I copied the latest (working) version of my INI file when I was using the type-safe code.
Rgds,
Alexandros
----- Original Message ---- From: John Haldi <john@...> To: Alex Marangos <alex.marangos@...> Sent: Tuesday, 1 July, 2008 1:36:23 PM Subject: RE: [Quickfix-developers] sendToTarget and "SessionNotFound" woes... Alex,
I'm a little confused. If you want to write FIX-version agnostic code, why are you using the DataDictionary for 4.0?
I don't know the details under the hood for the SendToTarget method, but what happens if you change UseDataDictionary to N, strip the DataDictionary entry from the config file completely, and then use the SendToTarget(msg,sID) signature with the quickfix.message object?
John From: quickfix-developers-bounces@... [mailto:quickfix-developers-bounces@...] On Behalf Of Alex Marangos Sent: Tuesday, July 01, 2008 8:11 AM To: quickfix-developers@... Subject: [Quickfix-developers] sendToTarget and "SessionNotFound" woes... Hi all, I'm writing a simple QuickFix application (just evaluating it for now) in C#, and I'm having problems getting sendToTarget to work... Sorry for the length of this email, but I'm completely baffled by what does and doesn't work... So far, I've created a ThreadedSocketInitiator with the following config: [DEFAULT] ConnectionType=acceptor SocketAcceptPort=40000 ReconnectInterval=60 FileStorePath=Logs\QuickFIX.Acceptor FileLogPath=Logs\QuickFIX.Acceptor PersistMessages=Y [SESSION] BeginString=FIX.4.0 SenderCompID=ACCEPTOR40 TargetCompID=INITIATOR40 StartTime=00:00:00 EndTime=23:59:59 HeartBtInt=5 UseDataDictionary=Y DataDictionary=FIX40.xml ValidateFieldsHaveValues=Y ValidateFieldsOutOfOrder=N On the receiving end I have an instance of the executor running, with the appropriate session configuration. I can start both applications and the sessions connect and heartbeat. Now I'm confused as to what's needed when creating a FIX message and using sendToTarget() in my application, as in some cases it works, in others it doesn't. The code to create and send the message looks like: 01: string beginString = "FIX.4.0"; 02: string senderCompID = "INITIATOR40"; 03: string targetCompID = "ACCEPTOR40"; 04: QuickFix.Message fixmsg = new QuickFix.Message(); 05: QuickFix.BeginString bgn = new BeginString(beginString); 06: QuickFix.SenderCompID scid = new SenderCompID(senderCompID); 07: QuickFix.TargetCompID tcid = new TargetCompID(targetCompID); 08: QuickFix.MsgType msgType = new QuickFix.MsgType(QuickFix.MsgType.ORDER_SINGLE); 09: QuickFix.OrdType ordType = new QuickFix.OrdType(QuickFix.OrdType.MARKET); 10: int rnd = new System.Random().Next(); 11: QuickFix.ClOrdID clOrdID = new QuickFix.ClOrdID(rnd.ToString()); 12: QuickFix.HandlInst handlInst = new QuickFix.HandlInst(QuickFix.HandlInst.AUTOMATED_EXECUTION_ORDER_PUBLIC); 13: QuickFix.OrderQty orderQty = new QuickFix.OrderQty(1000); 14: QuickFix.Symbol symbol = new QuickFix.Symbol("IBM"); 15: QuickFix.Side side = new QuickFix.Side(QuickFix.Side.BUY); 16: fixmsg.getHeader().setField(bgn); 17: fixmsg.getHeader().setField(scid); 18: fixmsg.getHeader().setField(tcid); 19: fixmsg.setField(ordType); 20: fixmsg.setField(msgType); 21: fixmsg.setField(clOrdID); 22: fixmsg.setField(handlInst); 23: fixmsg.setField(symbol); 24: fixmsg.setField(side); 25: fixmsg.setField(orderQty); 26: fixmsg.setField(ordType); 27: Console.WriteLine("Message to send: {0}", fixmsg.ToString()); 28: Console.WriteLine("BeginString: {0}", beginString); 29: Console.WriteLine("SenderCompID: {0}", senderCompID); 30: Console.WriteLine("TargetCompID: {0}", targetCompID); 31: SessionID sID = new SessionID(beginString, senderCompID, targetCompID); 32: Console.WriteLine("Session Exists: {0}", Session.doesSessionExist(sID)); 33: Session.sendToTarget(fixmsg, senderCompID, targetCompID); This throws a "SessionNotFound" error. Session.doesSessionExist(sID) returns "True", however... And if I replace sendToTarget() with: Session.sendToTarget(fixmsg, sID); I get an exception as follows: System.Runtime.InteropServices.SEHException: External component has thrown an exception. at _CxxThrowException(Void* , _s__ThrowInfo* ) at FIX.FieldMap.getField(FieldMap* , FieldBase* field) at Application.create(Application* , Message* unmanaged) at Application.toApp(Application* , Message* message, SessionID* sessionID) at FIX.Session.sendToTarget(Message* , SessionID* ) at QuickFix.Session.sendToTarget(Message message, SessionID sessionID) at QuickFIXMessageProvider.MessageProvider.Test2() in C:\Temp\QuickFIX\Prototypes\Test\Properties\MessageSender.cs:line 357 at QuickFIXMessageProvider.MessageProvider.ReceivedMsg(Message msg, String SenderCompID, String TargetCompID, String BeginString) in C:\Temp\QuickFIX\Prototypes\Test\Properties\MessageSender.cs:line 245 Now, if I change my code above to use QuickFix40.NewOrderSingle (instead of QuickFix.Message), it works... So just change line 04 to read: 04: QuickFix40.NewOrderSingle fixmsg = new QuickFix40.NewOrderSingle(); (commenting out lines 08 and 20 which set the MsgType) With the above changes (using version-specific message class), sendToTarget works fine, regardles of which method signature I use... (and sendToTarget(fixmsg, sID) doesn't throw the above exception either, it works fine). I'd like to avoid using FIX version-specific code if possible, which is why I'm trying to figure out what I need to do to get my code above to work correctly. Any help would be appreciated. Rgds, Alexandros Not happy with your email address? Get the one you really want - millions of new email addresses available now at Yahoo! No virus found in this incoming message. Not happy with your email address? Get the one you really want - millions of new email addresses available now at Yahoo! ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Quickfix-developers mailing list Quickfix-developers@... https://lists.sourceforge.net/lists/listinfo/quickfix-developers |
| Free Forum Powered by Nabble | Forum Help |