Overview
Features
Download
Documentation
Community
Add-Ons & Services

SocketStream doesnt send data when flushed

A general discussion forum.

SocketStream doesnt send data when flushed

Postby ACB » 28 Jul 2012, 02:13

i just started working with Poco but i encountered a strange problem.
Im using SocketStream on the client and server side to read/write to the socket but for some reason my client doesnt send anything until the conection is closed even though i am flushing the buffer.

clientside:
Code: Select all
SocketAddress addr("localhost",123);
            SecureStreamSocket sock(addr);
            SocketInputStream si(sock);
            SocketOutputStream so(sock);

            int test = 0;
            while(!si.eof() && test < 10)
            {
                so << ++test << flush;
                si >> test;
                scout << test << endl;
            }


serverside:
Code: Select all
void run() override
    {
        printf("Connected\n");
        cout << socket().address().toString() << endl;

        SocketInputStream si(socket());
        SocketOutputStream so(socket());

        int test = 0;
        while(!si.eof() && test < 10)
        {
            try
            {
                si >> test; // hangs
                cout << test << endl;
                so << test << flush;
            }
            catch(Poco::Exception& exc)
            {
                cout << exc.displayText() << endl;
                break;
            }
        }
    }
ACB
 
Posts: 1
Joined: 28 Jul 2012, 01:49

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron