Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 14:43

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Pipe problem (c \ bash \ every other language)
PostPosted: 16 Nov 2008 11:54 

Joined: 16 Nov 2008 11:44
Posts: 3
Hi guys,

I'm trying to make pipe between my ventrilo_srv (2.1.4) and a 'grep' command for example.
(for example: ./ventrilo_srv | grep "Ventrilo" or by using pipe() function in c)
But i'm receiving the results only after some thousand of bytes have been printed to the screen (stdout).
I need to get every line, or even every byte.

any help?

Thanks :)


Top
 Profile  
 
 
 Post subject: Re: Pipe problem (c \ bash \ every thing else)
PostPosted: 16 Nov 2008 14:43 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
uhmmm have you already tried to use "CloseStd=0" in the ini of your server?

another solution you can adopt is: ./ventrilo_srv 2>&1 | grep"Ventrilo"

at the moment I don't have other ideas


Top
 Profile  
 
 Post subject: Re: Pipe problem (c \ bash \ every other language)
PostPosted: 16 Nov 2008 15:31 

Joined: 16 Nov 2008 11:44
Posts: 3
doesn't works. =\
How does it make sense? Because i'm getting the stdout to my screen.. there is no way to catch it from the buffer to a string or something else? (with fork and pipe)
Can you try help me do that? i tried mkfifo() and pipe(), i'm stuck almost month :S

Another question - is there a way to make an "invisible" player (or player that can't be banned\kicked)?


Top
 Profile  
 
 Post subject: Re: Pipe problem (c \ bash \ every other language)
PostPosted: 16 Nov 2008 18:59 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
well, if you don't want to use the pipe because doesn't work good you can launch the process and getting all the std* with pipe.
on internet exist various example about how doing it in shorter or longer ways, I worked on pipes some years ago when I wrote cmdsock where you can find my window/linux implementation in the "quick_thread(cmdbind, int sd)" function.

and no, I'm not aware of ways to make the player invisible


Top
 Profile  
 
 Post subject: Re: Pipe problem (c \ bash \ every other language)
PostPosted: 16 Nov 2008 19:37 

Joined: 16 Nov 2008 11:44
Posts: 3
I think you didn't understand me, i will explain my self better now.
I don't have a prefer to a specific way, i tried use pipe(), myfif(), socket, and pipe with bash ( | ) - the whole ways no seems to be working.
for example i tried to use :

Code:
pipe(fd)
...
fork()
...
if child
execl("ventrilo_srv", "ventrilo_srv", NULL)

else //Parent
read()


and etc.. but the whole ways gave me the stdout only after some thousands of bytes.. (weird :S ).
i tried using setvbuf() for getting the stdout to be flushed every byte - as you see it wasn't helpful.

If you think your function - "quick_thread" - can help me in this case, i will be grateful to get a link :)
Or if you have another solution now after you understood what i meant i will be great!

Thanks and sorry for making you crazy :P


Top
 Profile  
 
 Post subject: Re: Pipe problem (c \ bash \ every other language)
PostPosted: 17 Nov 2008 20:23 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
no, if you have already tried the pipe/fork solution my function can't help (I have tested it here and doesn't catch the ventrilo output at all... mah).

anyway it's just something very strange, seems that all the output (for example using the > redirect) is flushed only when ventrilo_srv terminates... I don't have enough experiece with the handling of stderr/stdin/stdout to have an idea about this.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: