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



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