bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with TCPStream (CommonC++-1.6.1)


From: elmex
Subject: Problem with TCPStream (CommonC++-1.6.1)
Date: Thu, 4 Oct 2001 18:02:42 +0200
User-agent: Mutt/1.2.5i

Hi,

i have a problem with making a simple tcp-client
for writing a IRC-bot.
Here are the only lines of my code (very short):
---------------------------------------------
    #include <iostream>
    #include <string>
    #include <cc++/socket.h>

    int main() {
        cout << "suibot" << endl;

        TCPStream mystream("localhost",6664);
        mystream << "NICK elmex\r\n";
        mystream.sync();
        while(mystream.isConnected()) {
            while(mystream.isPending(SOCKET_PENDING_INPUT, 2000)) {
                char buf[2];
                mystream.getline(buf,1);
                cout << "line:" << buf[1] << endl;
            }
            cout << "Timeout" << endl;
        }
    }
---------------------------------------------
I tested this programm with NetCat:
Console1:
----------
address@hidden: ~$ nc -l -p 6664
NICK elmex
----------
I typed in Console1:
'Foobar and Stuff'

and console2, with the client started gives:
--------------------------------
suibot
IS CON!
Timeout
Timeout
line:
line:
line:
 ...
--------------------------------

I am wondering. The >> operators do work. but i want
unformatted input. Think of binary data or control-characters?

I am using CommonC++ version 1.6.1
uname -a: Linux x-paste.de 2.4.9 #2 Tue Oct 2 12:26:22 CEST 2001 i586 unknown
I have a AMD K6-2 300mhz 192 MB RAM.

If something is missing, mail me.


cya

-- 
Robin Redeker
www:    http://www.x-paste.de/
e-mail: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]