public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-users] [ECONNRESET]Problem with last buffer readed with a read or recv
@ 2004-10-20 14:01 Paolino paperino
  2004-10-20 16:13 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Paolino paperino @ 2004-10-20 14:01 UTC (permalink / raw)
  To: bluez users

Hi, i need some hints.
I writed a RFCOMM cleint side socket and its servere
side. The server sends an arbitrary sequence of 2048
bytes throught the write function. The client side
read as far as it receive a 0 or -1 frem the read.
The code is like this:
char *buffer[2048];
do {
   tmpPtr += nread;		
   nread = recv(fd, buffer, length, 0);
} while (nread > 0);

The problem arise when the server correctly send its
last bucket, the client must read it (read 2048
bytes), at the next read the client must get an EOF
(0) value from the recv...but this not happen it
receive -1 and errno=ECONNRESET. The same code works
as expected using TCP streams, but when it is used
over RFCOMM SOCK_STREAM it causes this anomaly.

Somebody could explain what happens, why the recv call
doesn't return a 0 when last data are reached on the
stream, but give an error message?

Thank's a lot
Best regards
 Andrea S.


		
___________________________________ 
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica… Scaricalo ora! 
http://it.messenger.yahoo.it


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-10-22 15:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-20 14:01 [Bluez-users] [ECONNRESET]Problem with last buffer readed with a read or recv Paolino paperino
2004-10-20 16:13 ` Marcel Holtmann
2004-10-20 19:15   ` Collin R. Mulliner
2004-10-22  8:03   ` Paolino paperino
2004-10-22 11:07     ` Marcel Holtmann
2004-10-22 15:13       ` Paolino paperino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox