0

I have a receiver, which provides a binary stream output on port 3001. But only one client can connect at the same time.

E.g. With first netcat IP-ADDRESS 3001 I get binary data. If I start the second one parallel, I get "Port already in use". I would like to have a server which provides the stream to many clients.

It should listen for clients on some port and if:

  • no client is connected -> do nothing
  • a client connects -> connect to the receiver and forward the data stream to the client
  • another client connects -> send the data stream to this client too
  • last client disconnects -> disconnect the connection to the receiver.

My Questions:

  • What is the technical name of the process, which I want to have (multiplexing, splitting?)?
  • Is there a linux service, which enables it out of the box?
ds14
  • 1
  • 1
  • 1
    If you are writing your own code, then you will want to start with any basic networking programming tutorial which shows you how to use the `accept()` function call to handle multiple clients on a tcp socket. If you are trying to cobble together something on the command line, please provide us with more details (what is your "receiver"? How do you start it?) – larsks Jun 19 '23 at 13:21
  • What you are talking about can be thought of as an instance of the Publish-Subscribe pattern. Many message brokers (e.g. Kafka & RabbitMQ) can do this out of the box for you, although they are message based rather than stream based. If the binary stream is not logically consisting of messages and is something like encoded audio or video streams, or other live sensor data, then maybe it would be called a Streamer. However, I am not familiar with out of the box solutions for that purpose. – JimD. Jun 21 '23 at 03:49

0 Answers0