Re: [Quickfix-developers] Problem with VB.NET
Brought to you by:
orenmnero
From: Oren M. <or...@qu...> - 2004-06-04 18:02:15
|
Ramprakash, The onLogoff and onLogon callbacks give you a sessionID. What I=20 usually do is keep a hash and add the sessionID in the onLogon call,=20 and remove it in the onLogoff call. Alternatively you can call the static lookupSession method on the=20 session class, and call isLoggedOn on the resulting Session object. =20 This way you can rely on QF to keep track of who is logged on for you. There isn't really anything special you need to do to handle an=20 application breakdown. QuickFIX will send you any messages that you=20 hadn't processed in the time you went down to when you come back up. =20 This should be transparent to you. One thing I would recommend for=20 high speed lines, is to send out a TestRequest message, and only begin=20= sending new messages when you get a response. In addition to taking a filename, the sessionsettings class can take=20 any stream in its constructor. So you can create a MemoryStream and=20 pass it in. Just make sure the contents of the stream are in the same=20= format as a configuration file. --oren On Jun 4, 2004, at 3:12 AM, Ramprakash Umapathy wrote: > Hi Oren, > =A0 > The FIX works fine and thanks. > =A0 > I looking=A0for the code snippets to do the following, > =A0 > 1. How to check for a particular session user=A0is already logged on = or=20 > the connection is alive? ( I see a method isLoggedOn in Acceptor and=20= > Initiator classes but not sure how to use in my VB code) > =A0 > 2. How to handle a situation in case of application breakdown (with=20 > some code sample?!) ? > =A0 > 3. How can I pass the parameters for SessionSettings from own=20 > customized application (not by using configuration files (*.cfg or=20 > whatsoever)? > =A0 > TIA, > Ramprakash > =A0 > =A0 > P.S : The sender is a newbie (to both QuickFix and :NET Technologies)=20= > and prefers to have code samples in VB.NET / C# > =A0 > =A0 > -----Original Message----- > From: qui...@li...=20 > [mailto:qui...@li...] On Behalf Of=20= > or...@qu... > Sent: luned=EC 31 maggio 2004 19:53 > To: Ramprakash Umapathy > Cc: qui...@li...; sa...@uc... > Subject: RE: [Quickfix-developers] Problem with VB.NET > > Ok, I've fixed this and was able to run your sample application with=20= > no problem.=A0 It appears that VB.NET got confused about const = pointers=20 > that were declared in MC++.=A0 I've attached a new=20 > quickfix/src/.NET/Application.h file.=A0If you replace the one you = have=20 > with this one you should be all set.=A0 I'll check this into CVS and = it=20 > will be in the next release as well. > Sam, I CC'd you on this because while researching this I noticed you=20= > posted the same problem earlier to the mailing list.=A0 Don't know if = it=20 > is still of interest to you but here is the fix. > =A0 > --oren > > -------- Original Message -------- > Subject: [Quickfix-developers] Problem with VB.NET > From: "Ramprakash Umapathy" <ram...@ca...> > Date: Mon, May 24, 2004 5:43 am > To: qui...@li... > > Hi All, > > I'm a newbie trying to use QuickFix in VB.NET > > I ran into problems with my code here. Could anyone of help me to=20 > solve. I > have seen a similar post with no answers. I use like this in my VB.NET=20= > code, > > > Imports QuickFix > Public Class QFapp > =A0 =A0Inherits QuickFix.MessageCracker > =A0 =A0Implements QuickFix.Application > > =A0 =A0Public Sub toApp(ByVal msg As QuickFix.Message, ByVal sid As > QuickFix.SessionID) Implements QuickFix.Application.toApp > =A0 =A0End Sub > > =A0 =A0Public Sub fromAdmin(ByVal msg As QuickFix.Message, ByVal sid = As > QuickFix.SessionID) Implements QuickFix.Application.fromAdmin > =A0 =A0End Sub > > =A0 =A0Public Sub onCreate(ByVal sid As QuickFix.SessionID) Implements > QuickFix.Application.onCreate > =A0 =A0End Sub > > =A0 =A0Public Sub onLogon(ByVal sid As QuickFix.SessionID) Implements > QuickFix.Application.onLogon > =A0 =A0End Sub > > =A0 =A0Public Sub onLogout(ByVal sid As QuickFix.SessionID) Implements > QuickFix.Application.onLogout > =A0 =A0End Sub > > =A0 =A0Public Sub toAdmin(ByVal msg As QuickFix.Message, ByVal sid As > QuickFix.SessionID) Implements QuickFix.Application.toAdmin > =A0 =A0End Sub > > =A0 =A0Public Sub fromApp(ByVal msg As QuickFix.Message, ByVal sid As > QuickFix.SessionID) Implements QuickFix.Application.fromApp > =A0 =A0End Sub > > End Class > > And then I call like this, > > Imports QuickFix > > Module Module1 > > =A0 =A0Sub Main() > > =A0 =A0 =A0 =A0Try > > =A0 =A0 =A0 =A0 =A0 =A0'Get Setting from ini file > =A0 =A0 =A0 =A0 =A0 =A0Dim ss As New SessionSettings("c:\client.ini") > =A0 =A0 =A0 =A0 =A0 =A0Dim sInit As SocketInitiator > =A0 =A0 =A0 =A0 =A0 =A0Dim sapp As New QFapp > > =A0 =A0 =A0 =A0 =A0 =A0Dim storeFactory As New FileStoreFactory(ss) > =A0 =A0 =A0 =A0 =A0 =A0Dim logFactory As New = FileLogFactory("c:\test.log") > =A0 =A0 =A0 =A0 =A0 =A0Dim msgFactory As New DefaultMessageFactory > > > =A0 =A0 =A0 =A0 =A0 =A0'Initiator Section > =A0 =A0 =A0 =A0 =A0 =A0sInit =3D New SocketInitiator(sapp, = storeFactory, ss,=20 > msgFactory) > =A0 =A0 =A0 =A0 =A0 =A0'sInit =3D New SocketAcceptor(sapp, = storeFactory, ss,=20 > logFactory, > msgFactory) > > =A0 =A0 =A0 =A0 =A0 =A0sInit.start() > > =A0 =A0 =A0 =A0 =A0 =A0sInit.stop() > > > > > > =A0 =A0 =A0 =A0Catch ex As System.Exception > > =A0 =A0 =A0 =A0 =A0 =A0Trace.WriteLine(ex.Message) > =A0 =A0 =A0 =A0 =A0 =A0Trace.WriteLine(ex.StackTrace) > > =A0 =A0 =A0 =A0End Try > > =A0 =A0End Sub > > End Module > > > The System throws an Error (doesn't even caught in Catch Block) with=20= > the > following message, > > > An unhandled exception of type 'System.TypeLoadException' occurred in > Unknown Module. > > Additional information: Signature of the body and declaration in a=20 > method > implementation do not match. =A0Type: TestFixEngine.QFapp. =A0Assembly: > TestFixEngine, Version=3D1.0.1605.20104, Culture=3Dneutral,=20 > PublicKeyToken=3Dnull. > > TIA, > > Holy > > > P.S: I could be helpful in anyone of you point out the QuickFix VB.NET > Resources > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle=20 > 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id149&alloc_id=8166&op=3Dclick > _______________________________________________ > Quickfix-developers mailing list > Qui...@li... > https://lists.sourceforge.net/lists/listinfo/quickfix-developers |