The RFCOMM protocol is one of the basic concepts of classic Bluetooth communication. The important thing used by the RFCOMM is a service's UUID. The service's UUID uniquely identifies the services that are supported by a Bluetooth-enabled device. It is something similar to a WEB protocol: a WEB server can provide HTTP, FTP, email services, etc.
The service UUID may also be referred to as a Bluetooth profile or service class. For example, the Serial Port Profile's UUID is 00001101-0000-1000-8000-00805F9B34FB.
The other important concept of the RFCOMM communication is the RFCOMM channel number. The RFCOMM channel number provides a way for connection to a selected service. You can think about RFCOMM channel numbers as about TCP/IP ports. It is related but not hard-linked to the service's UUID. For example, your WEB server may provide HTTP service on ports 80 and 8080. The same about the Bluetooth RFCOMM channel number. The Serial Port Profile can listen on channel number 1 and on channel number 3.
This is very useful when a device has more than one service with the same UUID. For example, the device may have SPP (Serial Port Profile) service for configuration listening on channel 5 and the other SPP for communication listening on channel 6. If the device has such a configuration, you can identify and select the correct service by its name, which is also maybe published in SDP records.
A Bluetooth-enabled device declares supported services in something known as SDP (Service Discovering Protocol). This is a specially designed server. A client device can connect to the SDP server and query about supported services.
Actual RFCOMM connection always executes to the specific RFCOMM channel number, not to the service's UUID. Usually, most popular libraries allow you to use just a service's UUID. But internally (in the library or by the Bluetooth driver), this UUID resolves (using SDP records) to the RFCOMM channel number.
To be able to connect to a Bluetooth-enabled device, you must correctly provide the service's UUID. And the target device must run a Bluetooth RFCOMM server that listens on the specified service's UUID (and on the associated channel number). Some services are predefined by some devices (for example, HeadSet should support HandsFree and A2DP profiles). But some can appear only when a user installed a special application that acts as a Bluetooth RFCOMM server.
Also, there is no limitation to using any custom UUID for your custom services.
In your code you use the Serial Port Profile service UUID. By default, that profile may not be supported by the devices you are trying to connect to. Depending on your needs, you may need to use another service's UUID or to install an application that supports the required service.
For example, when you are connecting to a smartphone, you may use any OBEX service's UUID. You can find more about OBEX by this link.
You can find more (with code examples) about Bluetooth RFCOMM communication by this link.
If there is something unclear, please ask in comments, and I will try to provide more information.