Re: Suggestions for reading binary data from a connected socket.

From: Roedy Green (look-on_at_mindprod.com.invalid)
Date: 07/20/04


Date: Tue, 20 Jul 2004 20:48:29 GMT

On Mon, 19 Jul 2004 23:50:47 -0700, "My Name"
<temp1001@debusschere.com> wrote or quoted :

>I am new to Java coming from Win32 C/CPP. After a lot of searching, I have
>yet
>to find an example explaining the best solution for reading and writing a
>binary
>message from a socket.

If you are starting from scratch and need to communicate with C, you
might use big-endian DataOutputStreams. If you are working with
legacy, you might use LEDataStream to read the little-endian data.

On the Java end, there is also nio which can handle both big and
little endian formats.

see http://mindprod.com/jgloss/endian.html

-- 
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming. 
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


Relevant Pages

  • Re: Multithread safety
    ... What I meant to say is: If one thread is writing to ... the socket while another one is reading to it (full-duplex), ...
    (microsoft.public.win32.programmer.networks)
  • Re: Sharing the socket between 2 threads
    ... My plan is to use 2 threads: main for writing and slave for background ... reading. ... how to share the socket between 2 threads? ...
    (comp.lang.tcl)
  • Re: How do I know ECONNREFUSED from non-blocking connect?
    ... > before the socket is reported as writable. ... Before the socket reports ... > don't go reading or writing if you really want to know what the ... I am actually writing a higher-level library! ...
    (comp.unix.programmer)
  • Re: Multithread safety
    ... > the socket while another one is reading to it (full-duplex), ... > its impossible in certain cases for the writing thread to ...
    (microsoft.public.win32.programmer.networks)
  • Re: FreeBSD 5.3 I/O Performance / Linux 2.6.10 | More Info
    ... Writing a byte at a time...done ... Reading a byte at a time...done ... Stat files in sequential order...done. ...
    (freebsd-performance)