I got a question according to your post with that server application example.
You wrote a function/routine which receives data over a buffer so that the data can be very large although the buffer is very small. There are lot of annoying things done in this dowhile-loop. Is it possible, (has basic4android the ability) to receive data just by doing something like calling a receive function, so that i dont have to care about all the buffer size- and file size- stuff like checking the size of the inputstream and counting the bytes, that are already received?
Okay thanks a lot!
I just wrote my own serverapp in B4A and i built a client in C# and it works well.
But now i tried to build this client in B4A and it works while sending a small text (smaller as the buffer size) but can you post me an example how to transmit a text larger as the buffer? For example just some words in a string with a small buffer Dim buffer(2) As Byte?
That would be very helpful cause i dont know how to handle with the inputstream size and the code for piecewise filling/reading from the buffer.
Thanks a lot!
You can use File.Copy2 to handle the transfer. You can convert a string to an input stream by first converting it to an array of bytes with "some string".GetBytes and then use InputStream.InitializeFromBytesArray to create an InputStream. Basic4android - Files (Core)
I am a bit lost. Looking at this site for 2 days, I still find it difficult to use this library. What I am looking for is to connect to a server on another machine and be able to send and receive text through a TCP socket.
Unfortunantaly the examples I find are either a server to receive files, or a client that just receives info from a NTP server.
Where can I find the documentation that describes the events that can be fired ? In the examples I find the connected event, but once connected what is fired if you receive data on the socket ? Or do I use a timer and check every so often ? How can I send data through the outputstream method.
this is exactly what I am looking for. Just sending a simple string to a TCP server. That's it. But so far I am fighting with the tutorial without success. Do you have meanwhile the information you needed? If yes, would you please share the outcome, so that I can profit from that?
I m having difficulty getting the example to work. Although I have managed to get it on to my device. When I run the desktop Application I get errors - No Connection cpuld be made, the target machine actively refused it 127.0.0.1:5007.
hi. Please tell me what could be the problem and wrote a simple program for sending messages. android with a computer message comes, and when I try to send from your computer, the application for Android-locked with an unknown error.