bug-commoncpp
[Top][All Lists]
Advanced

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

Re: TCPStream output flush() clears input


From: Ian Campbell
Subject: Re: TCPStream output flush() clears input
Date: Fri, 14 Dec 2001 09:57:16 -0000

Thanks David,
    At the moment I was calling the flush() method of TCPStream. A bit like
this:

TCPStream *connection;
unsigned char *message;


// Fill message contents
message = new unsigned char[19];
....

// Create connection
connection = new TCPStream(remote_peer,remote_port,512,true);

// Some data appears on input from the TCP connection

// Write message out and flush to peer
for (int i = 0; i < 19; i++) {
    connection->put(message[i]);
}
connection->flush();

// Input data no longer available.

When I try it flush() seems to act exactly like sync() - but as far as I can
see you inherit it directly from std::iostream, but I would be curious to
know your thoughts.

Ian Campbell
Band-X Ltd


----- Original Message -----
From: "David Sugar" <address@hidden>
To: "Ian Campbell" <address@hidden>
Cc: <address@hidden>
Sent: Thursday, December 13, 2001 9:18 PM
Subject: Re: TCPStream output flush() clears input


How are you trying to "flush"?  Are you using sync or the flush or endl
stream manipulator?  I think sync() clears both currently.

Ian Campbell wrote:

>Hello,
>    I am trying to use the TCPStream class and I have a problem when trying
>to flush the output to the remote host, that the input gets cleared. Now
>from my understanding of the iostream this shouldn't happen - only the
>output should be cleared. Is this a confusion on my part or should this not
>happen? At the moment I have worked around (for the purposes of writing the
>application)  by using a buffer size of 1, which eliminates the need for
any
>control of the output buffering. Any help would be much appreciated.
>
>Regards,
>
>Ian Campbell
>Band-X Ltd.
>
>
>
>
>_______________________________________________
>Bug-commoncpp mailing list
>address@hidden
>http://mail.gnu.org/mailman/listinfo/bug-commoncpp
>







reply via email to

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