Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 94455 invoked from network); 30 May 2005 14:42:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 May 2005 14:42:20 -0000 Received: (qmail 80412 invoked by uid 500); 30 May 2005 14:42:19 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 80337 invoked by uid 500); 30 May 2005 14:42:19 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 80324 invoked by uid 99); 30 May 2005 14:42:18 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of aiaots@gmail.com designates 64.233.162.192 as permitted sender) Received: from zproxy.gmail.com (HELO zproxy.gmail.com) (64.233.162.192) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 30 May 2005 07:42:15 -0700 Received: by zproxy.gmail.com with SMTP id 8so1600888nzo for ; Mon, 30 May 2005 07:42:02 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=SAbmjt9bBParnSrnVhc7Of9uzBSuGNikmZj1JY4AHOpNYlNHF+as9UoevTGJ9qdtjFd49+0cYFdbuOv05MXt00gyfNjcTbFYCEFyFNXLllApB5w3ruglg4tH4/koO6nCeyU1VzOKyc9/m7BQZ15EXcK0NVrhUwjyT1ep5WJrN4I= Received: by 10.36.154.10 with SMTP id b10mr508825nze; Mon, 30 May 2005 07:42:02 -0700 (PDT) Received: by 10.36.79.6 with HTTP; Mon, 30 May 2005 07:42:02 -0700 (PDT) Message-ID: <6b8ec7060505300742469c6ff7@mail.gmail.com> Date: Mon, 30 May 2005 17:42:02 +0300 From: Sander Aiaots Reply-To: Sander Aiaots To: dev@directory.apache.org Subject: [mina] ByteBuffer and MessageDecoder/MessageEncoders Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, I have a question about MessageDecoder/MessageEncoder,=20 For example I create client, what is associated with MessageEncodert that transforms String into bytes and one other Object also into bytes. So I send these two objects away: sess.write(myobject);//22 bytes sess.write("12345342711"); //11 bytes But MessageDecoder decode is called once with ByteBuffer containing 33 bytes of data? Why isn't decode called twice with 22 bytes of data, and then 11? Or sometimes, I saw that, decode is called twice, but both times It contains 33 bytes of data. Or am I misunderstood, that TCP actually is like stream, so I must build mechanism how-to separate messages? Or is there some kind implementations exist in MINA already? On decode I read bytes out: byte[] buf =3D new byte[in.remaining()]; in.get(buf, in.position(), in.remaining()); So why I am getting this ByteBuffer twice with same data? Hopefully my question was understandable. Best regards, Sander Aiaots