public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Brito Morales <lorenzo.brito@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Help
Date: Fri, 18 Sep 2009 07:19:23 -0400	[thread overview]
Message-ID: <c1d79cc40909180419t45198d46h91b06ca20383fc12@mail.gmail.com> (raw)

Hi, im a beggineer in bluez and also in programming stuff, i have read
a coupble of things about bluez and programming,  what i want to do is
a progran that send files to the phone is near by,,im trying to get
work these code, its compile, and conect to the phone , but in the
phone ask for a number security, ahta later i have to type in the
computer...... how can i send a file whitout asking a number? just
asking in the phone about aceptting the file
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>

int main(int argc, char **argv)
{
    struct sockaddr_rc addr = { 0 };
    int s, status;
    char dest[18] = "00:23:F1:CC:BF:10";

    // allocate a socket
    s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);

    // set the connection parameters (who to connect to)
    addr.rc_family = AF_BLUETOOTH;
    addr.rc_channel = 1;
    str2ba( dest, &addr.rc_bdaddr );

    // connect to server
    status = connect(s, (struct sockaddr *)&addr, sizeof(addr));

    // send a message
    if( 0 == status ) {
        status = send(s, "hello!", 6, 0);
    }

    if( status < 0 ) perror("uh oh");

    close(s);
    return 0;
}

             reply	other threads:[~2009-09-18 11:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-18 11:19 Lorenzo Brito Morales [this message]
2009-09-18 13:18 ` Help Iain Hibbert
  -- strict thread matches above, loose matches on Subject: below --
2022-06-03 23:04 help Thomas Green

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=c1d79cc40909180419t45198d46h91b06ca20383fc12@mail.gmail.com \
    --to=lorenzo.brito@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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