Server/Client app

magarcan

Active Member
Licensed User
Longtime User
Hi! I want to develop an app able to send (an receive) some data with a computer.

One way in what I'm thinking is stablish connection via network and exchange info using UDP packets.

Do you know any better way??? I've read that using AsyncStreams is very useful in order to do this.

Do you know any sample file can I use as base??

As I want my app be able to "talk" with computer, I'm developing another app in .NET. I know how to use UDP packets, but what does AsyncStreams use?? Maybe sockets??

Thanks!!
 
Last edited:

Rui

Member
Licensed User
Longtime User
Last edited:
Upvote 0

magarcan

Active Member
Licensed User
Longtime User
What do you mean by 'computer'? Is this a publicly accessible server over the internet, or is it a local machine on a local network?
I've my phone connected to internet using my Wifi router. Then, I've my computer connected by the same way. They are in the same network.

I want to send some data (UDP packet for example) from my phone to a .NET windows form app running on my computer.

Using UDP means that you don´t now for sure that a package have arrived or have been lost, this may be suitable for some applications but not for others. what kind of application are you building ?
I know how UDP protocol works

Take a look at this before you start maybe it will help you
http://www.b4x.com/forum/basic...html#post53629
Thanks!!
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
I've my phone connected to internet using my Wifi router. Then, I've my computer connected by the same way. They are in the same network.
The reason I asked was that you will have to do more work if you are connecting from a different network (for e.g. 3G to a device on Wifi).

Depending on the type of data UDP or AsyncStreams can be used, but I think that AsyncStreams will always use TCP/IP. And yes, you will need sockets to get the streams.

Have a look at:
http://www.b4x.com/forum/basic4android-getting-started-tutorials/7669-asyncstreams-tutorial.html
http://www.b4x.com/forum/basic4android-getting-started-tutorials/7001-android-network-tutorial.html
Basic4android - Network
http://www.b4x.com/forum/additional...9099-network-library-v1-10-udp-supported.html
 
Upvote 0

Jim

Member
Licensed User
Longtime User
Asyncstreams is a tool/object to feed data into a TCP/IP socket's input and output streams. Asynch will queue messages in its buffer, then send them all at once. Asynchstreams handles all of this for you, on seperate threads mind you, and raises a _NewData event when data is received. UDP sockets do not have input or output streams, simply, you build the packet yourself and send it when necessary. When a packet arrives the _PacketArrived event is raised. There are marked differences between TCP and UDP protocols, which, it seems like you are already aware. Depending on the type of application you are building, the requirements of data reception reliability, and the amount of traffic you will be sending will determine which protocol to implement.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…