Author Topic: Send Parallel  (Read 1643 times)

Offline Jazireh

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Send Parallel
« on: January 28, 2009, 02:56:44 PM »
can someone show me how i can send the file in parallel to more than one mobile per time without having to wait the receiver to accept or reject the message which was sent to them???
pls help

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2467
  • Karma: 1000
    • Wireless Communication Library
Re: Send Parallel
« Reply #1 on: January 28, 2009, 03:51:43 PM »
You can do it easy with using threads. One thread per connection.
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline Jazireh

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Send Parallel
« Reply #2 on: January 28, 2009, 04:00:41 PM »
hi ,
how i do it? i used multi thread program for each connection , but it didn't work currectly, would you give  me more example or code or explain more Please ?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2467
  • Karma: 1000
    • Wireless Communication Library
Re: Send Parallel
« Reply #3 on: January 28, 2009, 04:19:13 PM »
Code: [Select]
type
  TMyThread = class(TThread)
  private
    FAddress: string;
    FFile: string;
  protected
    procedure Execute; override;
  public
    constructor Create(Address: string; AFile: string);
  end;

constructor TMyThread.Create(Address: string; AFile: string);
begin
  FreeOnTerminate := True;
  FAddress := Address;
  FFile := AFile;
  inherited Create(False);
end;

procedure TMyThread.Execute;
var
  Sender: TBFObjectPushClient;
begin
  Sender := TBFObjectPushClient.Create(nil);
  try
    Sender.BluetoothTransport.Address := FAddress;
    Sender.Transport := atBuetooth;
    try
      Sender.Open;
      try
        Sender.Put(FFile);
      except
         // Unable send file
      end;
      Sender.Close;
    except
       // Catch errors here. Unable connect
    end;
  finally
    Sender.Free;
  end;
end;
WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager

Offline Jazireh

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: Send Parallel
« Reply #4 on: January 29, 2009, 10:28:55 AM »
Thanks a much Mike ,