[This message was posted by Clebson Derivan of CMA Inc <[email protected]> to
the "Algorithmic Trading" discussion forum at
http://fixprotocol.org/discuss/31. You can reply to it on-line at
http://fixprotocol.org/discuss/read/a53eeceb - PLEASE DO NOT REPLY BY MAIL.]
use one of examples found on quickfix project folder. try the executor or the
order match.
cheers,
Clebson
> do you know where can i test this fix message? the third pary company
> does not give this support since its a demo environment .. do you know
> where can i test this simple console app? thanks
>
>
>
>
>
>
> > it could be a lot of things: wrong sequence, wrong session parameters
> > ( session, version ), etc. the easy way to solve it is checking the
> > server logs to see how your login message was handled by it. if it is
> > quickfix based, check GLOBAL.event.log, GLOBAL.messages.log.
> >
> > cheers, Clebson Derivan
> >
> >
> > > Hello forum members, I have a problem receiving fix server
> > > indication when sending logon fix message I was creatig a c# console
> > > app program using async request to a fix demo gateway using this
> > > code: using System; using System.Text; using System.IO; using
> > > System.Net; using System.Net.Sockets; using
> > > System.Security.Cryptography; using System.Threading; namespace
> > > Simple_async_socket_coonnect {
> > >
> > > public static class GlobalVar {
> > >
> > >
> > >
> > >
> > >
> > > static Byte[] _globalValueByteGetreceive;
> > >
> > > /// <summary> /// Access routine for global variable. ///
> > > </summary> public static Byte[] GlobalValueByteGetreceive {
> > > get { return _globalValueByteGetreceive; } set {
> > > _globalValueByteGetreceive = value; } } /// <summary> ///
> > > Static value protected by access routine. /// </summary>
> > > static Byte[] _globalValueByteGet;
> > >
> > > /// <summary> /// Access routine for global variable. ///
> > > </summary> public static Byte[] GlobalValueByteGet { get {
> > > return _globalValueByteGet; } set { _globalValueByteGet =
> > > value; } }
> > >
> > > /// <summary> /// Global static field. /// </summary> public
> > > static bool GlobalBoolean; }
> > >
> > > class Program {
> > >
> > >
> > > static void Main(string[] args) {
> > > Console.WriteLine(DoSocketGet("*****"));
> > >
> > >
> > >
> > > } static string DoSocketGet(string server) {
> > >
> > > //Set up variables and String to write to the server.
> > > Random random = new Random(); Encoding ASCII =
> > > Encoding.ASCII; StringBuilder nt = new StringBuilder();
> > > nt.Append("8=FIX.4.4/9=136/35=A/49=*****/56=***/34=596"-
> > > ); //nt.Append("34=" + random.Next(1000) + " 52=" +
> > > DateTime.UtcNow.ToString("yyyyMMdd-
> > > HH:mm:ss") + " 98=0 108=30 554=" +
> > > sha256encrypt("1bird2lake") + " 10=015");
> > > nt.Append("/52="
> > > + DateTime.UtcNow.ToString("yyyyMMdd-HH:mm:ss") +
> > > "/98=0/108=30" + "/554=" + sha256encrypt("*****") +
> > > "/10=118/");
> > >
> > > string Get = nt.ToString(); Byte[] ByteGet =
> > > ASCII.GetBytes(Get); GlobalVar.GlobalValueByteGet =
> > > ByteGet; Byte[] RecvBytes = new Byte[256];
> > > GlobalVar.GlobalValueByteGetreceive = RecvBytes; String
> > > strRetPage = null;
> > >
> > >
> > >
> > > Socket s = null; IPEndPoint hostEndPoint; IPAddress
> > > hostAddress = null; int conPort = 5679; // Get DNS
> > > host information. IPHostEntry hostInfo =
> > > Dns.GetHostEntry(server); // Get the DNS IP
> > > addresses associated with the host. IPAddress[]
> > > IPaddresses = hostInfo.AddressList; hostAddress =
> > > IPaddresses[0]; hostEndPoint = new
> > > IPEndPoint(hostAddress, conPort); // Creates the
> > > Socket to send data over a TCP connection. s
> > > = new Socket(AddressFamily.InterNetwork,
> > > SocketType.Stream, ProtocolType.Tcp); // Connect to
> > > the host using its IPEndPoint. // ManualResetEvent
> > > connectDone = new ManualResetEvent(false);
> > > s.BeginConnect(hostEndPoint, new
> > > AsyncCallback(Connected), s);///async connection
> > > request request // connectDone.WaitOne(1000,false);
> > >
> > > return strRetPage;
> > >
> > > } public static void Connected(IAsyncResult iar) { Socket
> > > sock
> > > = (Socket)iar.AsyncState; try { sock.EndConnect(iar);
> > > sock.BeginSend(GlobalVar.GlobalValueByteGet, 0,
> > > GlobalVar.GlobalValueByteGet.Length, SocketFlags.None, new
> > > AsyncCallback(SendData), sock);
> > >
> > >
> > > } catch (SocketException) { Console.WriteLine("Unable to
> > > connect to host"); } } static void
> > > ReceivedData(IAsyncResult iar) { //I dont get a response
> > > from the server here i dont stop here at break point
> > > //its eather my code is wring or the fix message is
> > > wrong Socket remote = (Socket)iar.AsyncState; int recv =
> > > remote.EndReceive(iar); string receivedData =
> > > Encoding.ASCII.GetString(GlobalVar.Gl-
> > > obalValueByteGetreceive, 0, recv);
> > > Console.WriteLine(receivedData); } private static void
> > > SendData(IAsyncResult iar) {
> > >
> > >
> > > // ManualResetEvent connectDone = new
> > > ManualResetEvent(false); Socket server =
> > > (Socket)iar.AsyncState; int sent = server.EndSend(iar);
> > > server.BeginReceive(GlobalVar.GlobalValueByteGetreceive,
> > > , GlobalVar.GlobalValueByteGetreceive.Length,
> > > SocketFlags.None, new AsyncCallback(ReceivedData),
> > > server); // connectDone.WaitOne(3000); } public static
> > > string sha256encrypt(string phrase) { UTF8Encoding
> > > encoder
> > > = new UTF8Encoding(); SHA256Managed sha256hasher = new
> > > SHA256Managed(); byte[] hashedDataBytes =
> > > sha256hasher.ComputeHash(encoder.GetBytes(phrase));
> > > return byteArrayToString(hashedDataBytes); }
> > >
> > > public static string byteArrayToString(byte[] inputArray) {
> > > StringBuilder output = new StringBuilder(""); for (int i =
> > > 0; i < inputArray.Length; i++) {
> > > output.Append(inputArray[i].ToString("X2")); } return
> > > output.ToString(); }
> > >
> > > } } I am sending this string as my login message
> > > 8=FIX.4.4/9=136/35=A/49=****/56=MBT/34=1/52=20091230-
> > > 18:41:27//108=30/554=AD8C8A0692F9B051E0A6CA3ED6123F7430C3CBF08E-
> > > 3ABF15E54F47D92E93C3C7/10=118/ and don't get any
> > > response which means i am not getting into ReceivedData
> > > function I am stuck at this point and I wil be glad to
> > > get some direction what is the problem (might be my c#
> > > code or my fix string)
> > >
> > > best regards eyal
[You can unsubscribe from this discussion group by sending a message to
mailto:[email protected]]
--
You received this message because you are subscribed to the Google Groups
"Financial Information eXchange" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fix-protocol?hl=en.