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;
}
}
}





