Overview
Features
Download
Documentation
Community
Add-Ons & Services

[RESOLVED] Poco::Net::SocketStream for output

Please post support and help requests here.

[RESOLVED] Poco::Net::SocketStream for output

Postby aderouineau » 01 Jul 2009, 01:29

SocketStream seems to be working for getting input but not for writing output

Poco::Net::SocketStream& strm = *(new Poco::Net::SocketStream(_socket));

Poco::Net::HTTPRequest* rqst = new Poco::Net::HTTPRequest();
rqst->read(strm);
rqst->write(std::cout);

Reading works

Poco::Net::HTTPResponse* rps = new Poco::Net::HTTPResponse();
rps->write(std::cout);
rps->write(strm);
strm << "Test!";

This doesn't write anything (Test! is not displayed either)

_socket.sendBytes("hahaha", 7);

This one works.
Last edited by aderouineau on 02 Jul 2009, 15:37, edited 1 time in total.
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38

Re: Poco::Net::SocketStream for output

Postby guenter » 02 Jul 2009, 08:55

SocketStream is a buffered stream, therefore you should at some point flush it so that your output is actually sent through the socket:
Code: Select all
strm.flush();

or
Code: Select all
strm << std::flush();
guenter
 
Posts: 1153
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Poco::Net::SocketStream for output

Postby aderouineau » 02 Jul 2009, 15:37

Ahh ok thank you for that ^^
aderouineau
 
Posts: 163
Joined: 18 May 2009, 17:38


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron