From: Marcel Holtmann <marcel@holtmann.org>
To: BlueZ Mailing List <bluez-users@lists.sourceforge.net>
Subject: Re: [Bluez-users] closing a connection: timing
Date: Mon, 14 Mar 2005 11:24:04 +0100 [thread overview]
Message-ID: <1110795844.8158.50.camel@pegasus> (raw)
In-Reply-To: <42347901.9010202@gmx.ch>
Hi Marco,
> this is my "server-code":
>
> int client = accept(sock, (struct sockaddr *)&addr, &alen))
> char out[] = "200 100";
> send(client, out, strlen(out), 0);
> // sleep(2);
> close(client);
>
>
> I wrote a little client with the avetana library on my laptop and i'm able
> to receive the message "200 100".
>
> I tested it with my mobile phone (with exactly the same code as with the
> avetana library). Here I'm unable to receive the data. as soon as i try to
> open the inputstream, an exception ("connection already closed") is thrown.
> If I uncommend the sleep, it works an i get "200 100".
> I now don't know where the source of the problem could be. Do I miss
> something important? Mobile Phone bug?
>
>
> btw, I tested it with the bluetooth-terminal from kde and only receive "200
> 10". -> where is the last "0"?
I have no idea with the Java problem, but if you send only strlen()
bytes then you miss the null byte at the the end. So even for a char
array you should use sizeof(). If this is a text based protocol you
start to run over RFCOMM send add "\r\n" may also be a good idea.
Regards
Marcel
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
prev parent reply other threads:[~2005-03-14 10:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-13 17:31 [Bluez-users] closing a connection: timing Marco Trudel
2005-03-14 10:24 ` Marcel Holtmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1110795844.8158.50.camel@pegasus \
--to=marcel@holtmann.org \
--cc=bluez-users@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox