New async beta up!

Monkey Archive Forums/Monkey Discussion/New async beta up!

marksibly(Posted 2012) [#1]
Hi,

There's a new async beta here:

http://www.monkeycoder.co.nz/tmp/brl.zip

...includes some early docs, copy html folder to Monkey docs dir.

I've also updated iconfun - see bananas dir.

Changes:

* You now only have to call a single UpdateAsyncEvents function to update all async event sources.

* ReadChunk/WriteChunk have gone from AsyncStream.

* ReadAll/WriteAll remain, but use the same OnReadComplete, OnWriteComplete events that Read/Write use.

* There's a new AsyncTcpConnector which allows you to connect asynchronously but do reads/writes synchronously once connected. Not really recommended...stick with async!


Xaron(Posted 2012) [#2]
Great Mark! Thanks so much for your continuous efforts!

Any chance to have that streaming stuff for the coming Windows 8 target as well? :)


byo(Posted 2012) [#3]
Thank you, Mark!


Skn3(Posted 2012) [#4]
Cool will take a look when back from camping trip!


Xaron(Posted 2012) [#5]
Will that async stuff be part of the next Monkey version? :)


Tibit(Posted 2012) [#6]
It already is part of the current version :)


Xaron(Posted 2012) [#7]
Uh oh shame on me! Thanks!


Tibit(Posted 2012) [#8]
Finally got some time for networking again :D

Question. We have:

Method Read : Void ( data:DataBuffer, offset:Int, count:Int, onComplete:IOnReadComplete )

Begins reading from the async stream and returns immediately.
When either at least one byte has been read or EOF occurs, the OnReadComplete method of the onComplete object will be called.

Method ReadAll : Void ( data:DataBuffer, offset:Int, count:Int, onComplete:IOnReadComplete )

Begins reading from the async stream and returns immediately.
When either count bytes have been read or EOF occurs, the OnReadComplete method of the onComplete object will be called.

----------------------
Can't find in docs:

1. In Read what do offset and count do?
2. In ReadAll what do offset do?
Is this correct using ReadAll:
[monkeycode]Method OnReadComplete:Void(data:DataBuffer, offset:Int, count:Int, source:IAsyncEventSource)
Local byteArray:Int[count]
data.PeekBytes(0, byteArray, 0, count)[/monkeycode]

3. Why do we have two methods that does the same but have the same parameters?
4. How is the DataBuffer supposed to be setup before?
I did: data:DataBuffer = New DataBuffer(1024) ' Reusing it so 1024 is max size per packet in my case

5. IOnReadComplete looks like this: OnConnectComplete:Void(connected:Bool, source:IAsyncEventSource) <--- What am I supposed to do with source or when is it useful?
6. How do I convert byteArrays to strings?


Tibit(Posted 2012) [#9]
Finally got some time for networking again :D

Question. We have:

Method Read : Void ( data:DataBuffer, offset:Int, count:Int, onComplete:IOnReadComplete )

Begins reading from the async stream and returns immediately.
When either at least one byte has been read or EOF occurs, the OnReadComplete method of the onComplete object will be called.

Method ReadAll : Void ( data:DataBuffer, offset:Int, count:Int, onComplete:IOnReadComplete )

Begins reading from the async stream and returns immediately.
When either count bytes have been read or EOF occurs, the OnReadComplete method of the onComplete object will be called.

----------------------
Can't find in docs:

1. In Read what do offset and count do?
2. In ReadAll what do offset do?
Is this correct using ReadAll:
[MonkeyCode]Method OnReadComplete:Void(data:DataBuffer, offset:Int, count:Int, source:IAsyncEventSource)
Local byteArray:Int[count]
data.PeekBytes(0, byteArray, 0, count)[/monkeycode]

3. Why do we have two methods that does the same but have the same parameters?
4. How is the DataBuffer supposed to be setup before?
5. IOnReadComplete looks like this: OnConnectComplete:Void(connected:Bool, source:IAsyncEventSource) <--- What am I supposed to do with source or when is it useful?
6. How do I convert byteArrays to strings?