Android Question Send file from PC to Android and back

Discussion in 'Android Questions' started by Franky2303, May 17, 2015.

  1. Franky2303

    Franky2303 Member

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

  3. Franky2303

    Franky2303 Member

    I don't think, that is what i searched for. Couldn't it be as easy as VB.net to VB.net, over sockets or Base64 and TCP ?
    This is how it should work:
    On my PC (VB.net) is the server and on my phone is the client. If the client connects, the sever sends a list of songtitles, which the client receives and shows. Then you choose a songtitle on the client and it sends the title to the server. There the server sends the song which is related to the title and the client receives and plays the song.
     
  4. Franky2303

    Franky2303 Member

  5. Erel

    Erel Administrator Staff Member Licensed User

    Do you mean the B4J application?

    Try to connect from the desktop to the device. The other way will only work if you open a port in Windows firewall.

    The simplest way to communicate between an Android device and a desktop is by using B4J and B4A.

    However you can also write the desktop program with VB.Net. Just make sure not to use prefix mode: http://www.b4x.com/android/forum/threads/7669/#content
     
  6. Franky2303

    Franky2303 Member

    My device is an emulator, so the ip is 10.0.2.15. And this doesn't work either.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    When you say that something is not working you should describe what exactly happens. Do you see any error in the logs?

    I don't recommend you to use the Android emulator. It is slow and unreliable. Especially when dealing with networks.

    Try to connect from the emulator to the pc with the following ip address: 10.0.2.2
     
  8. Franky2303

    Franky2303 Member

    There are no errors. With the VB.net application, which I uploaded before, i can connect from emulator to pc with the ip 192.168.2.102 but with the B4J it doesn't work.

    EDIT: I found an error: (SocketException) java.net SocketException Socket closed
     
    Last edited: May 17, 2015
  9. Franky2303

    Franky2303 Member

    Ok, now i found something to fix a bit. I can now connect from emulator to server(b4j). But the server doesn't notice that. Could you test the two project, if they work for you, how I want to ?
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    Of course they work here. Otherwise I wouldn't have posted them.

    Which example are you trying? Are you using the ip address I previously wrote?
     
  11. Franky2303

    Franky2303 Member

  12. Erel

    Erel Administrator Staff Member Licensed User

    ?

    I recommend you to try it with a real device.
     
  13. Beja

    Beja Expert Licensed User

    In addition to Erel's solution you can also think about this one.
    Use the mini email-based server to send the file as attachment to an email.
    http://www.b4x.com/android/forum/threads/building-a-mini-email-based-server.35030/#content
    The process is initiated from the Android device app, where you can include the email 'send' request in any form of a string variable.. when server received your request (by bluetooth, email, etc).. then it will send you the file by email as attachment. After your device app sends the request then it will be polling the email for incoming (Valid) email message, you can then download and process the attachment. You do the same thing the other way round.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice