cyberco said:
Hi Steve and Gordon,
Sorry for not being more specific. A full-duplex socket means that you
can simultaneously read and write over the socket. In my case the
client is a mobile phone running J2ME and not all implementations of
the J2ME Virtual Machine (JVM) support full-duplex sockets. For
instance the Nokia 6600 does while the SonyEricsson P900 doesn't. This
is a 'feature' not well documented by phone manufacturers which can
lead to a lot of problems. In my case I'm porting a J2SE application to
J2ME that relies on full-duplex sockets. To make it work on a
SonyEricsson P900 I have change the code to use seperate sockets for
reading and writing to the server. Unfortunately the serverside
application does not support seperate sockets for reading and writing,
so I'm building a proxy that talks to my phoneclient using 2 sockets
and to the server using one socket. In other words the proxy splits a
full-duplex socket. My question is what the easiest (and best) way is
to do this.
Are you actually telling us that some of the phones in question support
simultaneous (in some sense) reading and writing on different sockets,
but not on the same one? That sounds awfully strange. Before you go to
much effort, you should make certain that your proposed solution will
actually work.
My bet would be that this is a hardware / OS issue, not a J2ME issue.
Some phones may have radios or electronics that cannot simultaneously
send and receive, for instance. That would mean that you cannot assume
full-duplex communication, period.
If you go ahead:
Does J2ME have ServerSockets? I'm guessing not. In that case, the J2ME
side must make two separate connections to the proxy, and somehow tell
the proxy which is the reading side and which the writing side, and
possibly what server to connect to (but that last could be implicit in
the choice of proxy). The proxy connects to the server, then commences
forwarding both sides of the conversation. It would probably be easiest
to code it in the form of one thread for forwarding each direction, but
there may be advantages to coding for selectable I/O within a single
thread in the proxy.
John Bollinger
(e-mail address removed)