I am attempting to make a simple telnet-like program in c++. What I need to know is: Is there a way to print out text coming from recv() over a socket while waiting for getch() to return?
I am attempting to make a simple telnet-like program in c++. What I need to know is: Is there a way to print out text coming from recv() over a socket while waiting for getch() to return?
Yes, there is a way.
But you're going to have to say which OS and compiler.
WinXP using Dev-c++
TryCode:if(kbhit()) getch(); else no_key_in_the_buffer();
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
thank you, that worked exactly as i needed it too. the last problem now is, is there a way to peek into the recieve buffer for my blocking socket to see if a message is in the buffer without having to call and wait for recv()?
Yes, you can use the ioctrlsocket function to check how much data is waiting to be recieved.Originally Posted by frozt
i can't find ioctrlsocket anywhere in msdn or google. could you post an example of how to use this?
Instead, search
ioctlsocket
thanks for the help