jgauffin / Griffin.Framework

Application framework for Business Applications
http://griffinframework.net
168 stars 62 forks source link

Tell the Framework to read more bytes #46

Closed Tochemey closed 9 years ago

Tochemey commented 9 years ago

Hello,

I am trying to use the network library to implement a protocol. I would like to know how I can tell the socket to read more bytes.

jgauffin commented 9 years ago

The receive part is asynchronous. As soon as you exit the decoder it will continue to read (and your decoder will be called agian when new data arrives). So it's important that you process all bytes that was received and keep track of the current state.

On Thu, Aug 13, 2015 at 10:11 AM, Arsene Tochemey GANDOTE < notifications@github.com> wrote:

Hello,

I am trying to use the network library to implement a protocol. I would like to know how I can tell the socket to read more bytes.

— Reply to this email directly or view it on GitHub https://github.com/jgauffin/Griffin.Framework/issues/46.

Tochemey commented 9 years ago

So far I have seen that you have provided some protocol decoders code in the Framework. That is great. My concern is in the ProcessReadBytes of the decoder where I want to read more data. I have seen that one in your blog as a Todo (http://blog.gauffin.org/2014/05/griffin-framework-performant-networking-in-net/) . Can you please tell me how to do that. I am suspecting I have to use the ISocketBuffer.SetBuffer but how is my problem. If this approach is not advisable please let me know.

Tochemey commented 9 years ago

For your information I want to add to the framework the Freeswitch protocol. I have already implemented it in another project and it is working very fine. But to make it accessible to everybody in your framework that is what I am doing(A port of my existing one to the Framework).

jgauffin commented 9 years ago

You can't force it to read. ProcessReadBytes will be invoked again automatically when more data have arrived over the socket.

On Thu, Aug 13, 2015 at 11:29 AM, Arsene Tochemey GANDOTE < notifications@github.com> wrote:

For your information I want to add to the framework the Freeswitch protocol. I have already implemented it in another project and it is working very fine. But to make it accessible to everybody in your framework that is what I am doing(A port of my existing one to the Framework).

— Reply to this email directly or view it on GitHub https://github.com/jgauffin/Griffin.Framework/issues/46#issuecomment-130590630 .

Tochemey commented 9 years ago

Ok. Thank you very much for your assistance. When I am done I push it.