Non destructive read of socket
- From: Mark <i@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 06 Oct 2009 09:58:33 +0100
Is it possible to do a non-destructive read on a socket in Java? I
want the functionality similar to the C library recv() using the
MSG_PEEK flag.
More information:
I am implementing an API in Java which needs to send a "are you alive"
application message over a socket. In reply it will get a "I am
alive" message. However there may be another type of message already
waiting which the API must not read. The presence of any message will
be enough for the API call to succeed. The "I am alive" message can
just be discarded if it is read later.
I realize I could buffer the messages internally, but I would prefer
to avoid this if possible owning to the risk of losing a message if
the application is terminated.
.
- Follow-Ups:
- Re: Non destructive read of socket
- From: Kevin McMurtrie
- Re: Non destructive read of socket
- From: Christian
- Re: Non destructive read of socket
- From: Daniel Pitts
- Re: Non destructive read of socket
- From: Knute Johnson
- Re: Non destructive read of socket
- From: Martin Gregorie
- Re: Non destructive read of socket
- From: GArlington
- Re: Non destructive read of socket
- From: Peter Duniho
- Re: Non destructive read of socket
- From: Lothar Kimmeringer
- Re: Non destructive read of socket
- Prev by Date: Re: Plugin architectures
- Next by Date: Re: Non destructive read of socket
- Previous by thread: spring + axis, access to bean
- Next by thread: Re: Non destructive read of socket
- Index(es):
Relevant Pages
|