Android Question VB6 to B4A - Help with Socket and GPS

RickV

Member
Whilst I fully comprehend the basic language (30+ years with QB4, VB3-6Ent Ed but no .net ) I struggle to get my head around the Socket with TCP Comms and the GPS libraries. I have read a lot on the forums and fail to find the "right stuff".

I have written many servers in VB6 Ent Ed that use a unique protocol over the socket connetion structured as follows
[Hdr] [Control} [Length] [CSum] [Data]
FF02 0-65535 nn 16bit xxxxxxxxxxxx........

This protocol uses the full character set 0-FF so I can send text or binary in the same protocol.

Now my problem, I need a socket library that I can just open and squirt data into with ease without cumbersome building around a data stream. ie:
B4X:
dim Sock as socket
sick.initialize
sock.connect ("192.168.1.21", 100)
sock.send [data packet]

sub sock_dataarrival
'___ Public Inn as string 'declared in starter globals section
Inn = Inn & sock.input
end sub

Has anyone a library that will do just this ?????

Also, what library do I use to get the NMEA data from the Samsung s9 gps ?
Required for.......
1. current location
2. determine distance between you and me.
3. obtain city name - not in nmea data I know I will have to reverse lookup this somewhere.

Any help will be mostly appreciated, I am so far behind on this already.

Cheers
Rick
Sydney, Australia.
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Please use [code]code here...[/code] tags when posting code.
2. Please write more meaningful titles. Otherwise this thread will never help other members who are searching for the same problem.

Socket based communication: https://www.b4x.com/android/forum/t...-asyncstreams-b4xserializator.119011/#content
It is based on the new B4XPages framework. Beta version with this framework as an internal library will be released today.

NMEA: https://www.b4x.com/android/forum/t...t-not-firing-on-android-10.112140/post-699351
 
Upvote 0

RickV

Member
I have just been through both projects, I understand te GPS project resides mainly in a starter module which is my requirement but hoping to get it all in the starter module.

the Socket sample I see has "Sub Class_Globals" and assuming the whole thing runs within this class module.
My question is, Can we use this class without the B4X views and wholly just create an instance of it and have the class object stay alive once created in Starter Module and stays alive the life of Starter ?

I hope I haven't confused you all......
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
My question is, Can we use this class without the B4X views and wholly just create an instance of it and have the class object stay alive once created in Starter Module and stays alive the life of Starter ?
B4XPages has nothing to do with "B4X views". I recommend you to use B4XPages as it will make things much simpler. A class initialized from the starter service will remain alive until the process is killed.
 
Upvote 0
Top