Re: [Quickfix-developers] Function problem in vb.net
Brought to you by:
orenmnero
|
From: Brian E. <azz...@ya...> - 2006-11-15 15:23:47
|
You're probably having a threading issue. The .NET framework controls do no= t handle calls to them from other threads especially well (sometimes they w= ork, other times they don't).=0A=0AI'm just guessing here, but I'd guess th= e onCreate call is probably running on your main thread (you instantiate a = QF Application-derived object, which creates the sessions, which call the "= onCreate" callback), while the onLogout is coming from the internal QF sock= et thread (this is an asynchronous callback). The first one works because y= ou are in the "main" or "GUI" thread, while the second one fails because yo= u are on a different thread.=0A=0AI'm not sure how VB.NET handles this (I'm= a C# guy myself), but in the C# world you have to check the control's "Inv= okeRequired" property, and if true, use its "Invoke" method to create a mes= sage that gets handled by the GUI thread.=0A=0A=0AA quick and dirty example= :=0A=0Aprivate delegate void SessionIDDelegate(SessionID sessionID);=0A=0Ap= ublic void onLogout(SessionID sessionID)=0A{=0A // Are we on the main GU= I thread?=0A if (Form1.TextBox.InvokeRequired)=0A {=0A // No - = call this function on the main GUI thread=0A Form1.TextBox.Invoke(ne= w SessionIDDelegate(onCreate), new Object[]{sessionID});=0A }=0A else= =0A {=0A // We're on the main GUI thread - safe to update control= s=0A Console.Write("ONLOGOUT");=0A Form1.TextBox.Text =3D "LO= GOUT";=0A }=0A}=0A=0AHope this helps.=0A=0A- Brian Erst=0AThynk Software= , Inc.=0A=0A----- Original Message ----=0AFrom: cstrader <cstrader232@cstra= der.com>=0ATo: qui...@li...=0ASent: Wednesday,= November 15, 2006 8:21:13 AM=0ASubject: [Quickfix-developers] Function pro= blem in vb.net=0A=0AQuickFIX Documentation: http://www.quickfixengine.org/q= uickfix/doc/html/index.html=0AQuickFIX Support: http://www.quickfixengine.o= rg/services.html=0A=0A=0A=0A=0A =0A =0A=0A=0AI have a weird =0Aproblem in v= b.net 2005 that is causing me major headaches. The =0Aproblem is that som= e commands given within quickfix functions do not =0Aexecute.=0A=0A =0A=0AF= or instance,=0A=0A =0A=0AThis sub writes to both the console and the =0Atex= tbox:=0A=0A=0APublic Sub onCreate(ByVal sessionID As QuickFix.SessionID) Im= plements =0AQuickFix.Application.onCreate=0A=0A Console.write("ONCREATE"= )=0A=0A Form1.TextBox1.Text =3D "ONCREATE"=0A=0AEnd Sub=0A=0ABut althoug= h this =0Asub writes to the console, it does NOT write to =0Aform1.textbox1= !!!=0A=0A=0A=0A=0APublic Sub onLogout(ByVal sessionID As QuickFix.SessionID= ) Implements QuickFix.Application.onLogout=0A=0A=0A Console.write("ONLOG= OUT")=0A=0A Form1.TextBox1.Text =3D "LOGOUT"=0A=0AEnd Sub=0A=0AAlso, the= ToApp sub =0Ais OK in this regard, but the FromApp sub does not print to t= he textbox =0Aeither???=0A=0Athanks!=0A=0A =0A=0Achuck=0A=0A =0A=0A =0A=0A= =0A=0A ----- Original Message ----- =0A=0A From: =0A John Haldi =0A =0A= =0A To: cstrader =0A=0A Sent: Wednesday, October 25, 2006 9:26 =0A AM=0A= =0A Subject: RE: Any luck?=0A=0A =0A=0A=0A Its very common for NetAdmins= to disable pinging from =0A external IPs. But you need to get the broker= 's IT guy on the phone and =0A explain that you're trying to connect to th= eir FIX engine and see if he can =0A determine whether there are any permi= ssion issues preventing you from =0A connecting.=0A=0A=0A =0A =0A From:= cstrader =0A [mailto:cst...@cs...] =0ASent: Wednesday, Octobe= r 25, 2006 =0A 10:12 AM=0ATo: John Haldi=0ASubject: Re: Any =0A luck?=0A= =0A=0A=0A =0A=0A No...but thanks for asking.=0A=0A =0A=0A If I can't p= ing the ip address my broker has =0A given me, and there is no reason that= I can think of on my end, what do you =0A think that means?=0A=0A =0A= =0A =0A=0A =0A ----- Original Message ----- =0A=0A From: =0A Jo= hn Haldi =0A =0A=0A To: cstrader =0A=0A Sent: Wednesday, October 2= 5, 2006 10:01 =0A AM=0A=0A Subject: Any luck?=0A=0A =0A=0A=0A = =0A=0A =0A=0A --------------------------------------=0A=0A John H= aldi=0A=0A Allagash Trading, LLC=0A=0A 120 Broadway, 20th =0AFloor=0A= =0A New York, NY 10271=0A=0A 212.433.3958=0A=0A jo...@al...= =0A=0A =0A-------------------------------------------------------------= ------------=0ATake Surveys. Earn Cash. Influence the Future of IT=0AJoin S= ourceForge.net's Techsay panel and you'll get the chance to share your=0Aop= inions on IT & business topics through brief surveys - and earn cash=0Ahttp= ://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDEVDEV= =0A_______________________________________________=0AQuickfix-developers ma= iling lis...@li...=0Ahttps://lists.sour= ceforge.net/lists/listinfo/quickfix-developers=0A=0A=0A=0A |