|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
READ-Event on #File.in ???Hi everybody!!!
Is it possible to get a READ-Event on #File.in? Background is: The external process, which is spawning my program, is a little bit flaky regarding its timings. It pushes it's data randomly via STDOUT into my prog. When I use the "WHILE NOT Eof(File.In)"-Example taken from the online help, I always get disconnected from the external process, after the WEND...but I have to send some data back, too! ;-) To bring some light into the dark: At first, i have to read the whole message block (terminated by an empty line), after that, I'm able to send my onw data back to the process. If I didn't misunderstand the concepts of READ-Event, it sit's on the stream and every time data arrives, it reads the incoming data automagically :-) TIA Stevie ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: READ-Event on #File.in ???On mercredi 09 juillet 2008, gambas@... wrote:
> Hi everybody!!! > > Is it possible to get a READ-Event on #File.in? > > Background is: The external process, which is spawning my program, is a > little bit flaky regarding its timings. It pushes it's data randomly via > STDOUT into my prog. > When I use the "WHILE NOT Eof(File.In)"-Example taken from the online help, > I always get disconnected from the external process, after the WEND...but I > have to send some data back, too! ;-) > To bring some light into the dark: At first, i have to read the whole > message block (terminated by an empty line), after that, I'm able to send > my onw data back to the process. > > If I didn't misunderstand the concepts of READ-Event, it sit's on the > stream and every time data arrives, it reads the incoming data > automagically :-) > > TIA > Stevie > If you declare a STATIC PUBLIC SUB named Application_Read() in your startup class, then you will get what you want: the File.In stream is watched, and the Application_Read() function is called as soon as there is something to read on the standard input. Regards, -- Benoit Minisini ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
|
|
|
Re: READ-Event on #File.in ???gambas@... schreef:
>> If you declare a STATIC PUBLIC SUB named Application_Read() in your startup >> class, then you will get what you want: the File.In stream is watched, and >> the Application_Read() function is called as soon as there is something to >> read on the standard input. >> > > Hi Benoit, > > sorry, I couldn't find any further docu regarding > Apllication_READ(). ..nothing via "F1", nothing in the wiki. It's seem's to > be one of the hidden secrets! ;-) > How do I get access on the data?? How must Application_Read() should look > like??? > I'm pretty new to this OO-Stuff....so I depend on docu or examples! > ....sorry!! > > Greetz > Stevie > > > I have tried to get it running too, but my Application_Read() routine never gets called, so I gave for that moment. I'm not sure how it works either, sorry. If someone knows, please put your example code here: http://www.gambasdoc.org/help/comp/gb/application/.read?en Regards, Ron_2nd ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: READ-Event on #File.in ???On jeudi 10 juillet 2008, Ron wrote:
> gambas@... schreef: > >> If you declare a STATIC PUBLIC SUB named Application_Read() in your > >> startup class, then you will get what you want: the File.In stream is > >> watched, and the Application_Read() function is called as soon as there > >> is something to read on the standard input. > > > > Hi Benoit, > > > > sorry, I couldn't find any further docu regarding > > Apllication_READ(). ..nothing via "F1", nothing in the wiki. It's seem's > > to be one of the hidden secrets! ;-) > > How do I get access on the data?? How must Application_Read() should look > > like??? > > I'm pretty new to this OO-Stuff....so I depend on docu or examples! > > ....sorry!! > > > > Greetz > > Stevie > > Can you get it triggered? > > I have tried to get it running too, but my Application_Read() routine > never gets called, so I gave for that moment. > I'm not sure how it works either, sorry. > > If someone knows, please put your example code here: > http://www.gambasdoc.org/help/comp/gb/application/.read?en > > Regards, > Ron_2nd > It worked when I implemented it, but now there is a bug that I'm currently trying to fix. Stay tune... -- Benoit Minisini ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: READ-Event on #File.in ???On jeudi 10 juillet 2008, Benoit Minisini wrote:
> On jeudi 10 juillet 2008, Ron wrote: > > gambas@... schreef: > > >> If you declare a STATIC PUBLIC SUB named Application_Read() in your > > >> startup class, then you will get what you want: the File.In stream is > > >> watched, and the Application_Read() function is called as soon as > > >> there is something to read on the standard input. > > > > > > Hi Benoit, > > > > > > sorry, I couldn't find any further docu regarding > > > Apllication_READ(). ..nothing via "F1", nothing in the wiki. It's > > > seem's to be one of the hidden secrets! ;-) > > > How do I get access on the data?? How must Application_Read() should > > > look like??? > > > I'm pretty new to this OO-Stuff....so I depend on docu or examples! > > > ....sorry!! > > > > > > Greetz > > > Stevie > > > > Can you get it triggered? > > > > I have tried to get it running too, but my Application_Read() routine > > never gets called, so I gave for that moment. > > I'm not sure how it works either, sorry. > > > > If someone knows, please put your example code here: > > http://www.gambasdoc.org/help/comp/gb/application/.read?en > > > > Regards, > > Ron_2nd > > It worked when I implemented it, but now there is a bug that I'm currently > trying to fix. Stay tune... OK, a stupid bug was fixed in revision #1445. -- Benoit Minisini ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
|
|
Re: READ-Event on #File.in ???On jeudi 10 juillet 2008, gambas@... wrote:
> > If you declare a STATIC PUBLIC SUB named Application_Read() in your > > startup class, then you will get what you want: the File.In stream is > > watched, and the Application_Read() function is called as soon as there > > is something to read on the standard input. > > Hi Benoit, > > sorry, I couldn't find any further docu regarding > Apllication_READ(). ..nothing via "F1", nothing in the wiki. It's seem's > to be one of the hidden secrets! ;-) The Application_Read global event handler is documented in the Application class documentation page. But you won't get more information than I wrote you. > How do I get access on the data?? How must Application_Read() should look > like??? > I'm pretty new to this OO-Stuff....so I depend on docu or examples! > ....sorry!! > > Greetz > Stevie > You must understand how watched file objects work. A file is an object of class "File" that will raise events when it is watched: the Read event when there is something to read on that File object, the Write event when there is something to write. As the standard input is a special case, I defined the "Application_Read" static public method as the global "Read" event handler for the standard input, provided that this method is defined in the startup class. Here is a little example that write on a file the standard input. But you must upgrade to revision #1445 to be sure that it will work! ' Gambas module PRIVATE $hOut AS File PUBLIC SUB Main() $hOut = OPEN "~/output.txt" FOR WRITE CREATE END PUBLIC SUB Application_Read() DIM sData AS String READ sData, -256 IF Len(sData) = 0 THEN ' Means that the input was closed CLOSE #File.In CLOSE #$hOut ELSE WRITE #$hOut, sData, Len(sData) ENDIF END Regards, -- Benoit Minisini ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Gambas-user mailing list Gambas-user@... https://lists.sourceforge.net/lists/listinfo/gambas-user |
| Free Forum Powered by Nabble | Forum Help |