Article View: fj.windows.x
Article #1891Re: IV-3.1 RPC classes with g++
From: HIRANO Satoshi
Date: Wed, 16 Jun 1993 18:39
Date: Wed, 16 Jun 1993 18:39
42 lines
2623 bytes
2623 bytes
In article <1993Jun16.103920.9820@ludd.luth.se> peppar@ludd.luth.se (Peter Peppar Parnes) writes:
>>Sorry, I found another problem last night. It looks hard to fix and I
>>am thinking how to treat it.
>
>What's the problem?
The RPCWriter class negotiates transfer mode and endian with
its peer at the opening of a connection. The negotiation protocol is
quite simple, that is, sending characters representing its modes
to its peer. Since there are two modes to be negotiated
in this negotiation, a RPCWriter sends two characters to the peer.
The coding of iostreamb::negotiate() looks like:
stream << localMode; stream.flush();
stream >> remoteMode;
// check binary transfer mode
stream << localMode; stream.flush(); // (A)
stream >> remoteMode; // (B)
// check endian
After sending a character, flushing of the output stream is required
in order to flush out the character from the stream.
// see comment of iostreamb::negotiate() for detail.
The problem is that the flushing at (A) may discard a pending
character in the input stream. The discarded character is, of course,
required for the next input at (B). If this situation occurs, the (B)
will never return.
An idea was getting rid of discarding of pending characters from
flush(). // see rpcbuf::sync().
I tried this, but communication became unstable.
Another idea is use of write() at (A) instead of stream. But this is
not elegant.
I found another problem today. Sending float or double loses a byte.
Sigh...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
HIRANO Satoshi Electrotechnical Laboratory, Japan
hirano@etl.go.jp
The future is Fluid.
Technical Details
Message-ID:
<HIRANO.93Jun17033956@buna.etl.go.jp>Path:
arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!ccut!news.u-tokyo.ac.jp!wnoc-tyo-news!etl.go.jp!etlss2!hiranoReferences:
<HIRANO.93Jun11233136@buna.etl.go.jp> <HIRANO.93Jun16182529@buna.etl.go.jp> <1993Jun16.103920.9820@ludd.luth.se>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1667f1,54d741101832359f,start X-Google-Attributes: gid1667f1,public X-Google-Thread: 101a2b,2b1f41b6261b09ac X-Google-Attributes: gid101a2b,public X-Google-ArrivalTime: 1993-06-16 14:06:32 PST Newsgroups: fj.windows.x,comp.windows.interviews Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!ccut!news.u-tokyo.ac.jp!wnoc-tyo-news!etl.go.jp!etlss2!hirano From: hirano@etl.go.jp (HIRANO Satoshi) Subject: Re: IV-3.1 RPC classes with g++ In-Reply-To: peppar@ludd.luth.se's message of 16 Jun 93 10: 39:20 GMT Message-ID: <HIRANO.93Jun17033956@buna.etl.go.jp> Sender: news@etl.go.jp (News System) Nntp-Posting-Host: buna Organization: Electrotechnical Laboratory, JAPAN References: <HIRANO.93Jun11233136@buna.etl.go.jp> <HIRANO.93Jun16182529@buna.etl.go.jp> <1993Jun16.103920.9820@ludd.luth.se> Distribution: comp Date: Wed, 16 Jun 1993 18:39:56 GMT Lines: 42