Overview
Features
Download
Documentation
Community
Add-Ons & Services

StreamCopier not working with SocketStream

Please post support and help requests here.

StreamCopier not working with SocketStream

Postby amoshkov » 20 Sep 2007, 21:57

Hi,

This post relates to the following tutrial: http://appinf.com/poco/wiki/tiki-index.php?page=tutorialtcpsockets

I am trying to copy an input stream from a StreamSocket into std::cout.
ReceiveBytes works fine but StreamCopier::copyStream fails.

I am sending a string from a SocketServer and need to receive the string at the client side using a socket.


On the client side I first open a socket and connect to the socket server succesfully:

SocketAddress sa(svsHost, svsPort);.
StreamSocket ss1(sa);.

Calling the following code succeeds:

char buffer[256];
int numBytesReceived = ss1.receiveBytes(buffer, sizeof(buffer));


But the next following code fails:

SocketInputStream strIn(ss1);

"int numBytesCopied = StreamCopier::copyStream(strIn, std::cout);"

The value of the returned numBytesCopied is 0



Any ideas?

Thanks,
Avner



amoshkov
 
Posts: 3
Joined: 17 Sep 2007, 21:00

Re: StreamCopier not working with SocketStream

Postby alex » 21 Sep 2007, 03:20

> The value of the returned numBytesCopied is 0

> Any ideas?

See this post.

Alex
alex
 
Posts: 1114
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: StreamCopier not working with SocketStream

Postby amoshkov » 21 Sep 2007, 19:37

Hi Alex,

Thanks for your answer.
I'm new to POCO, and so I need to get as much information as possible.
I have tried searching for the string "SocketInputStreams" in POCO lists, but havn't found anything automatically.
Only following your reply I was able to manually locate this post (in Forums -> POCO Support, page 4)
For the future, is there a way to search through the entire post listing?

Thanks,
Avner

amoshkov
 
Posts: 3
Joined: 17 Sep 2007, 21:00

Re: Re: StreamCopier not working with SocketStream

Postby amoshkov » 21 Sep 2007, 19:38

Hi,

Thanks for your answer.
I'm new to POCO, and so I need to get as much information as possible.
I have tried searching for the string "SocketInputStreams" in POCO lists, but havn't found anything automatically.
Only following your reply I was able to manually locate this post (in Forums -> POCO Support, page 4)
For the future, is there a way to search through the entire post listing?

Thanks,
Avner

amoshkov
 
Posts: 3
Joined: 17 Sep 2007, 21:00

Re: Re: Re: StreamCopier not working with SocketStream

Postby alex » 22 Sep 2007, 00:25

> I have tried searching for the string "SocketInputStreams" in POCO lists, but havn't found anything automatically.
> Only following your reply I was able to manually locate this post (in Forums -> POCO Support, page 4)
> For the future, is there a way to search through the entire post listing?

It seems that forums search does not work and global site search does not search forums. Unfortunately I can't help you with this issue.

Peter can you look at this?

Alex
alex
 
Posts: 1114
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron