I am currently trying to set up pub/sub messaging between two Android devices (within Unity specifically) but have found that for some reason, only the connect()
-method works on Android devices while "binding" does not. Thus, having one Android device successfully "connecting" to the address, the other Android device, in turn, needs to be "bound" to the address but as explained, this does not work for some reason on Android. The messaging works perfectly fine when going from PC to Android (either device) but once built on the Android devices, the bind connection fails. Current setup:
Pub:
void Awake()
{
AsyncIO.ForceDotNet.Force();
pub = new PublisherSocket();
pub.Options.SendHighWatermark = 10;
pub.Bind($"tcp://{IP}:5556");
}
void Update()
{
pub.SendFrame(camData);
}
Sub:
void Awake()
{
AsyncIO.ForceDotNet.Force();
subSocket = new SubscriberSocket();
subSocket.Connect($"tcp://{IP}:5556");
subSocket.Subscribe("");
}
void Update()
{
subSocket.TryReceiveFrameBytes(System.TimeSpan.Zero, out message);
}