B4J Question Secure socket (tcp listener) for server side

scGuy

Member
Licensed User
I've gone down the rabbit hole a few times searching the forums, and wondering if I'm missing something obvious. I would like to exchange arbitrary data over secure tcp from a b4a client app to a b4j server application. I have found and successfully implemented everything necessary on the client side in b4a ...establishing an outbound SSL connection to a server, works great.

When it comes to creating a listening server in b4j, I come up blank. To clarify, not interested in navigating the "WebSockets" protocol etc, rather would simply like to create basic tcp connection handling such as...

a) b4j listens for tcp on port xyz
b) b4a initiates secure connection to b4j server
c) b4j detects incoming connection, handshakes SSL, accepts connection
d) b4a sends arbitrary string like "hello" securely
e) b4j sends arbitrary response like "world" securely

...my searches indicate it is not possible to handle incoming secure tcp connections in a server role using any b4-whatever tool? Instead I feel like I'm missing something, so decided to ask the dumb question here.

Thanks!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Building a server application based on sockets is a mistake as there are better options available.

ServerSocket indeed doesn't support binding to SSL sockets.
You can however use jServer and communicate with WebSockets or regular http requests.

To clarify, not interested in navigating the "WebSockets" protocol etc, rather would simply like to create basic tcp connection handling such as...
Building a solution yourself will not be simpler and will be less robust and reliable.

Another option is to use an external MQTT broker that supports SSL connections. This will be very simple to implement.
 
Upvote 0
Top