tags:

views:

35

answers:

2

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.

A: 

You want select(2,3p).

Ignacio Vazquez-Abrams
Can you please shed more light?
Harsh
stdin is FD 0. http://linux.die.net/man/2/select
Ignacio Vazquez-Abrams
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..
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