Thread overview
reading and writing from a socket simo at once
Jul 07, 2005
Ameer Armaly
Jul 07, 2005
Regan Heath
Jul 07, 2005
Regan Heath
July 07, 2005
Hi.
How would I be able to read from a socket, but still take in info from the
keyboard and send it out;kind of like telnet?

-- 
---
Life is either tragedy or comedy.
 Usually it's your choice. You can whine or you can laugh.
--Animorphs


July 07, 2005
On Wed, 6 Jul 2005 17:31:56 -0400, Ameer Armaly <ameer_armaly@hotmail.com> wrote:
> How would I be able to read from a socket, but still take in info from the keyboard and send it out;kind of like telnet?

Start a thread, in that thread read data from the socket into a buffer. The main thread then loops checking for data in the buffer and checking for keystrokes. You need a non blocking keystroke checking function, some functions block until a complete line has been entered. You'll need to synchronise access to the socket and the buffer, probably best to place both of these in a class dedicated to this purpose.

Regan

July 07, 2005
On Wed, 6 Jul 2005 17:31:56 -0400, Ameer Armaly <ameer_armaly@hotmail.com> wrote:
> How would I be able to read from a socket, but still take in info from the keyboard and send it out;kind of like telnet?

Here is an example telnet program I just wrote in D. I don't guarantee it works at all, especially on anything other than windows, or for the most basic things.

Regan