dim, 03 Jan 2010, Matthew Brand skribis: > 2010/1/3 bill lam <[email protected]>: > > I guess you should have a loop for send/recv. > > In NinjaTrader, OnBarUpdate() is called for each time step (i.e. > effectively inside a loop). > > The loop: > // } while (bytes > 0); > > to recieve messages in multiple parts where they are too long for the > buffer gets stuck for me, even when I am only sending 15 bytes. I gave > up in the end and decided to comment it out and use a huge buffer. > > > Did you try the > > client/server example in J. > I used them to get going. They are very useful (you might notice that > most of the J code is copy pasted from the lab). > > I do not know much about socket in c#, is > > it synchronous or asysc ? > The one I am using is sync and blocking. C# sends a message, and waits > until J sends a message back. J waits for a message and sends one back > after processing. It is a bit crap really, I am not good at > programming these types of things - but it works for me for now :-).
I think that you are just so lucky that it works. ;-) If you did not close the write channel of a socket or kill the socket, the remote side will never receive the 0-byte data. You can just use the jserver in ~system/examples/socket "as is" and implement the client in c#. -- regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
