2 * (c) Oleg Puchinin 2008
3 * graycardinalster@gmail.com
9 int main (int argc
, char ** argv
)
12 Connection
* m_remote
;
22 printf ("usage: connection <IP> <PORT>\n");
28 c
->setName ("remote");
31 m_stdin
= new Connection
;
32 m_stdin
->setSocket (fileno (stdin
));
33 m_stdin
->setName ("local");
35 if (c
->connect (argv
[1], atoi (argv
[2])) < 0) {
42 m_pull
->add (m_stdin
);
45 count
= m_pull
->poll (1000);
53 while ((c
= m_pull
->scan ()) && c
) {
54 if (c
->ioNRead () == 0)
57 memset (m_buf
, 0, 4096);
58 if (EQ (c
->name (), "remote")) {
61 write (1, b
->data (), b
->len ());
62 } else if (EQ (c
->name (), "local")) {
63 c
->read (m_buf
, c
->ioNRead ());
66 m_remote
->send (m_buf
, strlen (m_buf
));