Android Question Send file from PC to Android and back

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.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime 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.

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 ?
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: https://www.b4x.com/android/forum/threads/7669/#content
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime 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
 
Upvote 0
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:
Upvote 0
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 ?
 
Upvote 0

Beja

Expert
Licensed User
Longtime 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.
https://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.
 
Upvote 0
Top