NORM point-to-point between two processes on the same machine? #39
-
If there are two separate processes on two separate machines, and NORM JNI is used to perform a point-to-point connection, the following works:
With this, the send works and data is transferred. If these two separate processes are running on the same machine, say 192.168.91.131, each can't perform a "NormSession session = instance.createSession(addr, port, NormNode.NORM_NODE_ANY);" with the same ip addr and port because the second execution of createSession() results in something like: Proto Error: ProtoSocket::Bind(9950) bind() error: Address already in use The NORM JNI does not include other interface options for initiating a session from the NormInstance class. As such, can NORM JNI be used to create a point-to-point connection between two processes on the same machine/ip, or is this a limitation on the point-to-point implementation via JNI? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I have only used the C++ API for multicast applications, but in the C++ API there is the NormSetRXPortReuse() call to allow the sender and receiver to run on the same host. Perhaps there is the same in the Java API? |
Beta Was this translation helpful? Give feedback.
-
As @marygilliland points out, when running multiple NORM applications on the same machine for the same multicast address/port, you need to use NormSetRxPortReuse() so multiple sockets on the same machine can bind to the same port. Note this only works for IP multicast addresses due to the way networks stacks are implemented on some machines (the NormSocket API extension that is in progress does use connect() for UDP sockets when a connection-oriented paradigm makes sense and the tighter binding there does allow multiple unicast UDP connections in that case, but I digress) The JNI API does have the NormSetRxPortReuse() call. However, while the C++ "norm/examples/normMsgr.cpp" does invoke that option, the corresponding "norm/examples/java/NormMsgr.java" does not. If you examine the normMsgr.cpp code you can probably see how that should be applied. I will make an effort to update the NormMsgr.java. Note that you may also have to enable multicast "loopback" for it to work as well and there is a NORM API for that, too. That is where it will be good for me to update the NormMsgr.java to make sure it is complete. The NormMgr.java example is the best Java example in the code base. There are 3 example applications I have been focused on with the intention of supporting C/C++, Java, and Python equivalents: normMsgr - uses NORM_OBJECT_DATA as a "message" transport example normStreamer - uses NORM_OBJECT_STREAM for either "byte-stream" or "message-stream" operation. normCast - uses NORM_OBJECT_FILE to illustrate file transfer / broadcast I have not yet created the Java or Python for the latter two, but one can use the C/C++ code as a guide in the meantime along with the NormMsgr.java or normMsgr.py that illustrate using the API in a working multi-threaded application. |
Beta Was this translation helpful? Give feedback.
As @marygilliland points out, when running multiple NORM applications on the same machine for the same multicast address/port, you need to use NormSetRxPortReuse() so multiple sockets on the same machine can bind to the same port. Note this only works for IP multicast addresses due to the way networks stacks are implemented on some machines (the NormSocket API extension that is in progress does use connect() for UDP sockets when a connection-oriented paradigm makes sense and the tighter binding there does allow multiple unicast UDP connections in that case, but I digress)
The JNI API does have the NormSetRxPortReuse() call. However, while the C++ "norm/examples/normMsgr.cpp" does invoke t…