The “server” ( local PC) allocates a “socket” with parameters
s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
and is set ( waits ) to receive connection from “client”.
It is unclear , but logical that “client terminal “ should be specified - perhaps “client (host) bluetooth address – array of six entries should be entered somewhere – as a “remote address”.
I am using term “terminal X address “ to get away from confusing usage of “address” which can be IP (generic network) or bluetooth address.
So far the term “host” is associated with IP name / address and is really not specific to client or server.
The bluetooth address seems to have no relations to IP address.
The “client” (Rpi) software allocates a “socket” with parameters
socket_descriptor_local = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
the “client” - (Rpi ) software originates connection to server ( connect to server bluetooth terminal address ) when data is ready to be passed onto “server” . For now I am passing simple message(s) only.
It is also unclear how / where to specify “client terminal”.
Currently I have two bluetooth hardware (USB) of different class connected.
I do not see how "socket" cares about bluetooth class.
I managed to run both software and received expected errors.
Like to know WHO , not why, actually generates the "connection refused" - logically it should came from "connecting to RECEIVING terminal" , but I am not so sure how to identify that.