users@jaxb.java.net

Re: JAXB Sockets and Joy.

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 30 May 2006 12:27:15 -0700

Hi,

How do you check that the client is not receiving anything? Can you
perhaps insert a FilterOutputStream on the server side and check if data
is sent through to the socket or not? Similarly a network monitor to see
if it's on the TCP connection?

Also, take a look at XML channel example that does a similar thing.
(In the future please direct these questions to users_at_jaxb.dev.java.net.)


Julian Clark wrote:
> Hi Kohsuke,
>
> My name is Julian, and I've been having some grief with making JAXB
> play nice with sockets. I read your blog entry about JAXB and socket
> pitfalls and I tried to implement a solution along those lines. If you
> have a few moments, I'd really appreciate some pointers.
>
> I'll start with what I am trying to do. I'm trying to serialise an
> object, and pass it between my server and 2 clients. it seems that
> when I marshall to my outputstream, that nothing appears to come
> through.
>
> It does appear at this point, that the socket has closed.
>
>
> These are the key code snippets...
>
>
> Server = new ServerSocket ( 11235, 2);
> BlackConnection = Server.accept();
> BlackOutput = new DataOutputStream(BlackConnection.getOutputStream());
> JAXBElement BlackJax = new JAXBElement(new
> QName("checkers/player","Player"), Player.class, BlackPlayer);
> m.marshal (BlackJax, System.out);
> m.marshal (BlackJax, BlackOutput);
>
> When I marshall to System.out, I get nice fully formed XML. when I
> marshall to BlackOutput, I get nothing. :(
>
> If I write a string to the socket, it happily comes through to my
> client app, unless I try to write after I try to marshall to that
> socket.
>
> Thank you very much for taking the time to read this and respond.
>
> Best Regards,
>
> Julian Clark


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com