Linux bluetooth development
 help / color / mirror / Atom feed
From: Ka Kin Cheung <michaelhku2002@yahoo.com.hk>
To: bluez-users@lists.sourceforge.net
Subject: Re: [Bluez-users] rfcomm question 3
Date: Thu, 17 Feb 2005 21:54:55 +0800 (CST)	[thread overview]
Message-ID: <20050217135456.6070.qmail@web60907.mail.yahoo.com> (raw)
In-Reply-To: <4214975C.7000808@gmx.ch>

[-- Attachment #1: Type: text/plain, Size: 4654 bytes --]

Hi Marco!
    I've put some functions you posted before into my main program. As I wish to write the program to act as server, I wrote like this:
int main (int argc, char **argv)
{
 //variable declaration...
 addr.rc_family = AF_BLUETOOTH;
 bacpy(&addr.rc_bdaddr, BDADDR_ANY);
 addr.rc_channel = 4;
 alen = sizeof(addr);
 //mysql initialization....
 while (1)
 {
  // request a socket from the operating system
  if((sock = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)) < 0)
  {
   printf("socket(...) failed");
   exit(1);
   }
  // bind the socket to the system
  if(bind(sock, (struct sockaddr *)&addr, alen) < 0)
  {
   printf("bind(...) failed\n");
   exit(2);
   }
  // set the socket into listen mode. handle 10 (QUEUE) connections.
  if(listen(sock, 10) < 0)
  {
   printf("listen(...) failed\n");
   exit(3);
   }
  while(client = accept(sock, (struct sockaddr *)&addr, &alen))
  {
   char remoteAddr[18];
   ba2str(&addr.rc_bdaddr, remoteAddr);
   printf("connection from %s:\n", remoteAddr);
   // send a "hello from server" to client
   char out[] = "hello from server";
   send(client, out, strlen(out), 0);
   printf("> %s\n", out);
   // read the answer
   char buffer[101]; // buffer size 100, 1 for '\0'
   int noReadChars = recv(client, buffer, sizeof(buffer)-1, 0);
   buffer[noReadChars] = '\0'; // here the received answer ends
   printf("< %s\n", buffer);
   while (1)
   {
          .......
 
After I ran it, the sock, bind and listen functions were all passed. But after that, I couldn't see any result about it. Then I wish to fiind out how to connect SE T610 to bluez in my PC, but I couldn't find the method. And the strange thing is that the phone could search my PC and then added it on the "My device" list, I was wondering why couldn't the phone initialize the connection to PC. I'm very surprising that Jay Summet said that T610 cannot connect to bluez in Linux PC. So I wish Jay also to explain why, and does it mean that there is no method that T610 can really initialize the connection to PC?
By the way, after I looked at the specification of the bluetooth system, I could not find any way to write sdp program. So, can you and other mail users suggest a method for me to do? I really thank you very much for your kindness.
Michael
 
Marco Trudel <mtrudel@gmx.ch> wrote:
Ka Kin Cheung wrote:
> Hi all!
> I'm still doing my project. Now I face a problem
> that the T610 still cannot connect to PC. Then my
> tutor said that I have to write a sdp program to let
> the phone to connect to PC.

this has nothing to do with it. i think you tutor is wrong...
if your pc is listening on a rfcomm channel, then you can connect with a
url like btspp://0123456789AB:4
the first part is the protocol, the second the mac address, the last one
the channel number.
have you tried/understood my last post to you:
http://sourceforge.net/mailarchive/message.php?msg_id=10756581

you need a sdp-entry only if the mobile phone wants to do a service search
(paging) what's not needed. a inquiry could get you the mac address and you
then can connect to the listening port in your program.

if it still doesn't work, please send a description of what you exactly do
and what the exact results are. please use hcidump as well...

regards
Marco


> I wish to know that is
> there any guideline or even the source code for sdp
> programming? It is urgent as my tutor said he used two
> months to do it before. 
> Thank you very much for your kindness.
> Michael
> 
> 
> _______________________________________________________________________
> 新年願望第一位 : 找到友緣人
> http://personals.yahoo.com.hk
> 
> 
> -------------------------------------------------------
> 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
> 
> 


-------------------------------------------------------
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



---------------------------------
新年願望第一位 :  找到友緣人 

[-- Attachment #2: Type: text/html, Size: 5960 bytes --]

  reply	other threads:[~2005-02-17 13:54 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-28 14:06 [Bluez-users] rfcomm question 1 Ka Kin Cheung
2005-01-28 17:36 ` Marcel Holtmann
2005-01-29  5:32   ` Ka Kin Cheung
2005-01-29 14:03     ` Marcel Holtmann
2005-01-31 13:41       ` Ka Kin Cheung
2005-01-31 14:22         ` Marcel Holtmann
2005-01-31 14:30           ` Ka Kin Cheung
2005-01-31 14:38             ` Marcel Holtmann
2005-02-01  6:25               ` [Bluez-users] rfcomm question 3 Ka Kin Cheung
2005-02-01  8:14                 ` Marcel Holtmann
2005-02-01 14:39                   ` Ka Kin Cheung
2005-02-02  2:49                   ` Ka Kin Cheung
2005-02-02  3:10                     ` Marcel Holtmann
2005-02-02  4:54                       ` Ka Kin Cheung
2005-02-02  5:34                         ` Marcel Holtmann
2005-02-03  3:42                           ` Ka Kin Cheung
2005-02-03  5:22                             ` Alain Volmat
2005-02-03 10:50                               ` Ka Kin Cheung
2005-02-03 10:59                                 ` Alain Volmat
2005-02-03 13:01                                   ` Ka Kin Cheung
2005-02-03 13:20                                     ` Marcel Holtmann
2005-02-03 14:26                                       ` Ka Kin Cheung
2005-02-03 14:54                                         ` Marcel Holtmann
2005-02-04 16:56                                     ` Marco Trudel
2005-02-05 12:48                                       ` Ka Kin Cheung
2005-02-05 13:17                                         ` Marco Trudel
2005-02-05 13:51                                           ` Marcel Holtmann
2005-02-05 14:00                                             ` Marco Trudel
2005-02-05 14:14                                               ` Marcel Holtmann
2005-02-05 17:39                                                 ` Marco Trudel
2005-02-05 18:08                                                   ` Marcel Holtmann
2005-02-17  5:37                                                     ` Ka Kin Cheung
2005-02-17  6:28                                                       ` Alain Volmat
2005-02-17  9:08                                                       ` mike
2005-02-17 13:08                                                       ` Marco Trudel
2005-02-17 13:54                                                         ` Ka Kin Cheung [this message]
2005-02-17 14:10                                                           ` Marco Trudel
2005-02-17 14:43                                                             ` Ka Kin Cheung
2005-02-17 17:04                                                               ` Marco Trudel
2005-02-18  3:28                                                                 ` Ka Kin Cheung
2005-02-19  6:49                                                                   ` Marco Trudel
2005-02-19  8:27                                                                     ` Ka Kin Cheung
2005-02-19 10:06                                                                       ` Marco Trudel
2005-02-19 13:45                                                                         ` Ka Kin Cheung
2005-02-18  3:33                                                                 ` Ka Kin Cheung
2005-02-18  7:51                                                                   ` [Bluez-users] multiple instances of OPUSH server Janice M. Ballesteros
2005-02-17 13:14                                                       ` [Bluez-users] rfcomm question 3 Marco Trudel
2005-02-02  3:16                     ` Alain Volmat

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=20050217135456.6070.qmail@web60907.mail.yahoo.com \
    --to=michaelhku2002@yahoo.com.hk \
    --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