Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] jetty-dev Digest, Vol 31, Issue 17

2011/9/29  <jetty-dev-request@xxxxxxxxxxx>:
> Send jetty-dev mailing list submissions to
>        jetty-dev@xxxxxxxxxxx
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        https://dev.eclipse.org/mailman/listinfo/jetty-dev
> or, via email, send a message with subject or body 'help' to
>        jetty-dev-request@xxxxxxxxxxx
>
> You can reach the person managing the list at
>        jetty-dev-owner@xxxxxxxxxxx
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of jetty-dev digest..."
>
>
> Today's Topics:
>
>   1. Re: WebSocket streaming (Simone Bordet)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 28 Sep 2011 20:14:46 +0200
> From: Simone Bordet <sbordet@xxxxxxxxxxx>
> To: "Jetty @ Eclipse developer discussion list"
>        <jetty-dev@xxxxxxxxxxx>
> Subject: Re: [jetty-dev] WebSocket streaming
> Message-ID:
>        <CAFWmRJ1CQUWo-G24UTEg5Juma8h0Q8f-9hDWY+fh57dcWdiDHA@xxxxxxxxxxxxxx>
> Content-Type: text/plain; charset=UTF-8
>
> Hi,
>
> 2011/9/28 Istv?n Bender <istvan.bender@xxxxxxxxx>:
>> I use Jetty 7.5.1 to implement websocket service which makes screen
>> captures and sends to the client. There is a DiffPicker class which
>> extends timertask. My WebSocket server side code looks like this:
>>
>> public class GWWebSocket implements WebSocket.OnTextMessage {
>>
>> ? ? ? ?private Connection connection;
>>
>> ? ? ? ?@Override
>> ? ? ? ?public void onClose(int arg0, String arg1) {
>> ? ? ? ?}
>>
>> ? ? ? ?@Override
>> ? ? ? ?public void onOpen(Connection connection) {
>>
>> ? ? ? ? ? ? ? ?this.connection = connection;
>> ? ? ? ? ? ? ? ?connection.setMaxIdleTime(10000);
>> ? ? ? ? ? ? ? ?connection.setMaxTextMessageSize(2*1024);
>> ? ? ? ? ? ? ? ?connection.setMaxBinaryMessageSize(64*1024);
>> ? ? ? ?}
>>
>> ? ? ? ?@Override
>> ? ? ? ?public void onMessage(String data) {
>> ? ? ? ? ? ? ? ?Logger.getRootLogger().info("Got message: " + data);
>>
>> ? ? ? ? ? ? ? ?final int tileSize = 64;
>> ? ? ? ? ? ? ? ?new DiffPicker(tileSize, new IScreenObserver() {
>>
>> ? ? ? ? ? ? ? ? ? ? ? ?@Override
>> ? ? ? ? ? ? ? ? ? ? ? ?public void cellChanged(int x, int y, BufferedImage image) {
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ByteArrayOutputStream baos = new ByteArrayOutputStream();
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?try {
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ImageIO.write(image, "png", baos);
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?baos.flush();
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?byte[] imageInByte = baos.toByteArray();
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?baos.close();
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?GWResponse response = new GWResponse(imageInByte, x, y);
>>
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?connection.sendMessage(response.getBytes(), 0,
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?response.getSize());
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?} catch (IOException e) {
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?// TODO Auto-generated catch block
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?e.printStackTrace();
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
>>
>> ? ? ? ? ? ? ? ? ? ? ? ?}
>>
>> ? ? ? ? ? ? ? ?}).start(1000, 40);
>> ? ? ? ?}
>>
>> }
>>
>> I got the following exception when the client sends a command:
>>
>> 0x0 0x0 0x0 0x84 0x0 0x0 0x0 0xf 0x0 0x0 0x0 0xd java.io.IOException:
>> closedOut 1000:null
>> ? ? ? ?at org.eclipse.jetty.websocket.WebSocketConnectionD13$WSFrameConnection.sendMessage(WebSocketConnectionD13.java:429)
>> ? ? ? ?at com.logmein.websocket.server.GWWebSocket$1.cellChanged(GWWebSocket.java:49)
>>
>> What's wrong?
>
> The WebSocket connection has been closed while your DiffPicker was
> waiting to trigger. When it triggered, the connection was already
> closed.
> The close code 1000 indicates that this is a normal close (called by
> application code).
> You should check if your application is closing websocket connections,
> or if the client did it.
>
> Simon
> --
> http://cometd.org
> http://intalio.com
> http://bordet.blogspot.com
> ----
> Finally, no matter how good the architecture and design are,
> to deliver bug-free software with optimal performance and reliability,
> the implementation technique must be flawless.?? Victoria Livschitz
>
> ------------------------------
>
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-dev
>
>
> End of jetty-dev Digest, Vol 31, Issue 17
> *****************************************
>

I'm totally stupid. You are right! There was an explicit disconnect
call in my client side code. Everything is working now. Sorry for
disturbing.


Back to the top