L Lutz99999 New Member Licensed User Longtime User Feb 1, 2013 #1 Hello i use async stream and the New_data event. in my main i must wait for the response from the network. And the AStreams_NewData event is not fired what can i do ? code : dim weiter as boolean Sub AStreams_NewData (Buffer() As Byte) weiter = true end sub Sub Send (what As String) do until weiter = true doevents loop end sub greetings Lutz
Hello i use async stream and the New_data event. in my main i must wait for the response from the network. And the AStreams_NewData event is not fired what can i do ? code : dim weiter as boolean Sub AStreams_NewData (Buffer() As Byte) weiter = true end sub Sub Send (what As String) do until weiter = true doevents loop end sub greetings Lutz
derez Expert Licensed User Longtime User Feb 1, 2013 #2 The NewData sub will run when data arrives, so you don't have to wait for it elsewhere, especially not in a loop: Code: Copy Sub AStreams_NewData (Buffer() As Byte) 'check what is in the buffer send(what) 'or do whatever you need to end sub Upvote 0
The NewData sub will run when data arrives, so you don't have to wait for it elsewhere, especially not in a loop: Code: Copy Sub AStreams_NewData (Buffer() As Byte) 'check what is in the buffer send(what) 'or do whatever you need to end sub
L Lutz99999 New Member Licensed User Longtime User Feb 1, 2013 #3 I understand what is the problem. when i finish the loop the event will be fired. can i manuell force the event do until weiter = true doevents force the fire event loop Upvote 0
I understand what is the problem. when i finish the loop the event will be fired. can i manuell force the event do until weiter = true doevents force the fire event loop
derez Expert Licensed User Longtime User Feb 2, 2013 #4 I understand what is the problem. Click to expand... Well, I don't. I think your problem is that the newData event is not fired and you do want it to fire, but the cause for this is in your connection or data transfer. The idea of Astream is that it knows when there is data ready and then the event is launched. You can run the sub manually but in that case you don't have the data ready and that is not a good idea. The loop is not necessary ! Upvote 0
I understand what is the problem. Click to expand... Well, I don't. I think your problem is that the newData event is not fired and you do want it to fire, but the cause for this is in your connection or data transfer. The idea of Astream is that it knows when there is data ready and then the event is launched. You can run the sub manually but in that case you don't have the data ready and that is not a good idea. The loop is not necessary !
mc73 Well-Known Member Licensed User Longtime User Feb 2, 2013 #5 Derez is absolutely right. If you need that your server sends some sort of 'welcome' message, then this would be there in your aStreams_newData. But... what is the response you are waiting for? How are you connecting to your server? Upvote 0
Derez is absolutely right. If you need that your server sends some sort of 'welcome' message, then this would be there in your aStreams_newData. But... what is the response you are waiting for? How are you connecting to your server?
Informatix Expert Licensed User Longtime User Feb 2, 2013 #6 If you want some explanations and a few advices, read this Upvote 0