.NET Components for Mobility

Remote Machine Names...

Last post 06-25-2009 1:57 AM by chaitanyav. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 09-23-2005 12:03 AM

    • Gee666
    • Not Ranked
    • Joined on 09-21-2005
    • Posts 0

    Remote Machine Names...

    I have an established connection (the server end of things) and am using this code to determine the remote machine name:

       this.textBox1.Text = bc.RemoteMachineName;

       this.textBox1.Invalidate(); this.textBox1.Refresh();

    The remote name is always blank and I can't even get a MAC address remotely.  What am I doing wrong??

    Thank you

     

    Gee

     

  • 09-23-2005 9:34 AM In reply to

    • steveh
    • Not Ranked
    • Joined on 09-22-2005
    • Dundee
    • Posts 0

    Re: Remote Machine Names...

    this is what i am using for logging phones, hope it is of help. I am fairly new to this too and slowly feeling my way.

     

    Dim bc As BluetoothClient = New BluetoothClient

    bdi = bc.DiscoverDevices(9) 'discover all the devices up to the maximum of 9

    dim devname as string= bdi(devicesfoundcount).DeviceName

    dim devmac as string = bdi(devicesfoundcount).DeviceAddress.ToString

     

     

  • 09-23-2005 10:51 AM In reply to

    • Gee666
    • Not Ranked
    • Joined on 09-21-2005
    • Posts 0

    Re: Remote Machine Names...

    Hi steveh

    First off, welcome to the forum :p

    There is nothing wrong with the approach you are using, but my code is not using the discovery process to find devices and so I do not use the device array and it's subsequent .DeviceAddress property.

    My software is "hard-coded" as one device will try and connect to a series of bluetooth dongles (on different machines) and if it fails it will try to connect to the next in the list.  I should be able to use the approach I outlined in my first post, but this is not yielding any information.  I could just send a "machine name" string over bluetooth but that seems a bit pointless if I can access the mac address using this API!

    Peter, is there something I am missing here?

    Thanks ;)

    Gee

     

  • 09-23-2005 1:15 PM In reply to

    Re: Remote Machine Names...

    There is an alternative. The BluetoothDeviceInfo constructor is now public and accepts a BluetoothAddress. Then you can use that to retrieve the name e.g.

    BluetoothDeviceInfo bdi = new BluetootDeviceInfo(addr);

    string deviceName = bdi.DeviceName;

    Where "addr" is the BluetoothAddress you used when connecting.

    As for why the RemoteMachineName doesn't work, I'll do some more checking...

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
  • 09-23-2005 2:58 PM In reply to

    • Gee666
    • Not Ranked
    • Joined on 09-21-2005
    • Posts 0

    Re: Remote Machine Names...

    Hi Peter

    I have multiple PDAs connecting to a single XP-Server.  The PDAs connect through a hard-coded mac address, so I could use the devices construct in the way you suggested to get the XP machine name from the PDA.

    However, the XP-Server will not know the mac addresss of the incoming PDAs until the connection is accepted (as I understand it).  Unfortunately, I am not able to retrieve the pda's mac address (from the xp machine) either so I can't use this approach for the pdas :(

    Any ideas??!

    Thanks ;)

     

  • 09-23-2005 4:04 PM In reply to

    Re: Remote Machine Names...

    From your listener, whenever you accept an incoming connection you'll either have a Socket or a BluetoothClient (depending on whether you used AcceptSocket or AcceptBluetoothClient). You can access the address of the remote device from the RemoteEndpoint of the Socket. From a BluetoothClient you can access the socket via the new Client property. The RemoteEndpoint property is an EndPoint so you'll need to cast it to BluetoothEndPoint e.g.

    BluetoothAddress ba = ((BluetoothEndPoint)bc.Client.RemoteEndpoint).Address;

    or

    Dim ba As BluetoothAddress = CType(bc.Client.RemoteEndpoint, BluetoothEndPoint).Address

     

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
  • 09-23-2005 8:40 PM In reply to

    • steveh
    • Not Ranked
    • Joined on 09-22-2005
    • Dundee
    • Posts 0

    Re: Remote Machine Names...

    and i will now gracefully withdraw..........

    i now realise i have just attempted to give my basic advice to someone who could "code me for breakfast".

    i appoligise for insulting you with my basic understanding of this whole thing,

    i must remember my place in the foodchain

    i must remember my place in the foodchain

    i must remember my place in the foodchain

    i must remember my place in the foodchain etc etc

    i'm going back to watching, listening and reading.

    trust me to get shot down in my first attempt at help, thanks for being kind.

  • 09-23-2005 8:59 PM In reply to

    • Gee666
    • Not Ranked
    • Joined on 09-21-2005
    • Posts 0

    Re: Remote Machine Names...

    Hi Steve

    I hope that neither me or Peter have in any way shot you down!  I can't speak for Peter, but I certainly never meant to!  It's people like you and Peter that make forums work as a place to exchange ideas and I appreciate your post, trust me, it will help someone ;)

    Look at this link here: http://32feet.net/forums/7/ShowPost.aspx

    This is me making a complete tit of myself by posting all sorts of things as possible reasons why I couldn't get something to work.  This one time I was lucky and took a step back and found the real reason (http://32feet.net/forums/21/ShowPost.aspx), but I could have just ended up looking stupid - like the time I emailed Peter from his blog asking about the basics....

    Remember, even a genius asks questions - after all - how did they get to be smart otherwise??!

    It's all good mate ;)

     

    Gee

    PS. Thank you for your response above Peter, I shall play with this code when I am back at work next week ;)

  • 09-23-2005 9:38 PM In reply to

    Re: Remote Machine Names...

    Steve, Your input is definately appreciated please do join in! We are all learning new stuff here so everything helps whether it's a useful code snippet or pointing out my errors :-) There are always different ways of approaching a particular task and its good to have a discussion about alternatives and pros and cons.

    Peter

    Peter Foot
    Microsoft Device Application Development MVP
    www.peterfoot.net | www.inthehand.com
  • 09-23-2005 9:49 PM In reply to

    • steveh
    • Not Ranked
    • Joined on 09-22-2005
    • Dundee
    • Posts 0

    Re: Remote Machine Names...

    cheers peter / gee.

    i was not so much feeling shot down but feeling like i was on rung 1 of a ladder and trying to offer advice to folks who are now using 500ft of scaffolding.

    you are right the collective aspect of forums really is what makes it.

    Steve

  • 06-25-2009 1:57 AM In reply to

    Re: Remote Machine Names...

    Hi Peter, How to get the Device Name in OBEXListener. Thank You
Page 1 of 1 (11 items)
Copyright © 2001-2010 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy.