I have two .NET core web APIs as docker containers. I want with NetMQ one to send messages and other listen to it. But I think I have some problems connectiong those two with tcp connection. I use Docker compose.
version: '3.4'
services:
gateway:
image: ${DOCKER_REGISTRY-}gateway
build:
context: .
dockerfile: Gateway/Dockerfile
ports:
- 5000:80
pictureperfect:
image: ${DOCKER_REGISTRY-}pictureperfect
build:
context: .
dockerfile: PicturePerfect/Dockerfile
ports:
- 5001:80
- 5002:5002
I want this one to send message
private void Send() {
using (var requester = new RequestSocket("tcp://0.0.0.0:5002")) {
try {
requester.SendFrame("message from pp");
Console.WriteLine(requester.ReceiveFrameString());
} catch (Exception) {
throw;
}
}
}
This is the one that I want to be listening
public static void Main(string[] args) {
CreateHostBuilder(args).Build().Run();
using (var responder = new ResponseSocket()) {
responder.Bind("tcp://pictureperfect:5002");
while (true) {
Console.WriteLine(responder.ReceiveFrameString());
Thread.Sleep(1000);
responder.SendFrame("message from gateway");
}
}
}