I was trying to develop a chat application using C programmable sockets. I need to check whether the stdin buffer has some value in it to send the message to the client/server and receive it. But I don't know how to check the stdin buffer for values. Please help.
Can you please shed more light?
Harsh
2010-10-20 04:37:11
stdin is FD 0. http://linux.die.net/man/2/select
Ignacio Vazquez-Abrams
2010-10-20 04:40:04
I suspect OP is not familiar with man page reference notation. This answer means you should look up the `select` function in either section 2 (system calls) or section 3p (POSIX standards) of your system's man pages.
R..
2010-10-20 12:30:08
A:
This might help
select() gives you the power to monitor several sockets at the same time. It'll tell you which ones are ready for reading, which are ready for writing, and which sockets have raised exceptions, if you really want to know that.
Beej's Guide to Network Programming has a nice and easy to follow discussion on it.
Andrew-Dufresne
2010-10-20 05:06:25