Frage

I am trying to implement a multimedia server application in NS-3 which can serve multiple clients.

Can a single NS-3 (TCP? and/or) UDP socket accept multiple simultaneous connections?

War es hilfreich?

Lösung

As stated in the ns-3 socket documentation, all socket calls in ns-3 are non-blocking (in contrast to the original socket API). This is a direct result of the asynchronous and event-based implementation model of ns-3.

The core concept to model a blocking socket call is to register a call-back which is invoked once a connection is established or data becomes available. One of these calls is ns3::Socket::SetRecvCallback which you can use to react to incoming packets

Of course, ns-3 can be used to implement a server that accepts multiple connections. For this purpose, you need to register to a call-back function such as ns3::Socket::SetRecvCallback and then to dispatch the received data adequately.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top