Connect multiple clients on same port number using OpenIGTLink

Hello,

I want to connect and stream images from an OpenIGTLink Server(sample server codes) to Slicer(streaming images) as well as a PyIgtl-client(for some preprocessing) on the same port number.

Can anyone please help me with this setup?

Thanks,
Best Regards,
Srijeet

If I understood your case correctly the servers should either be on different IPs or on different ports

However, if using a Plus Server it works fine, If I am connecting to two different clients on same IP and same ports. I have created a server using OpenIGTlink sample server codes. But it doesn’t connect to two different clients at the same time.

I want to know, how can I enable this feature or is there something I am missing!

Sorry didn’t understand that you are trying to connect 2 different clients to the same server

1 Like

Both PlusServer and Slicer (with the connection in “server” mode) can send data to any number of clients, such as Slicer (with the connection in client mode) and pyigtl client. I’ve just tested this between 3 Slicer instances (one in server mode, two in client mode, all using the same port) and it worked well.

Limitations:

  • I don’t think I’ve made pyigtl server able to handle multiple client connections. Once a client is connected, it does not accept new connections until that first client disconnects.
  • If a client stalls (keeps the connection open but does not consume the data) then it may block the server (until the client disconnects or starts communicating).
1 Like

Thanks, you are absolutely correct.

The server I am using is not Pyigtl server, the server is built using the OpenIGTLink server i.e C++ code. (Limitation 2: is observed with the Pyigtl server though)

Now my question is what exact changes do I need there, such that it can handle multiple clients (Just like the plus server for e.g). That would help a lot! thanks again :slight_smile:

If you don’t want to implement a new server that can handle multiple clients then you can use PlusServer or Slicer as server. Both these servers can accept messages from another server (that cannot handle multiple clients) and broadcast the message to multiple clients.