Jarimatti Valkonen Posted December 9, 2008 Report Share Posted December 9, 2008 Hi, Does the TCP connection refnum have any properties? I'd like to be able to determine the remote end IP address from it. However, with LV8.5 it seems that I can't get any properties out of it. Any toughts on the matter? Quote Link to comment
Francois Normandin Posted December 9, 2008 Report Share Posted December 9, 2008 QUOTE (Jarimatti Valkonen @ Dec 8 2008, 09:26 AM) Hi,Does the TCP connection refnum have any properties? I'd like to be able to determine the remote end IP address from it. However, with LV8.5 it seems that I can't get any properties out of it. Any toughts on the matter? You can't access any properties or methods for TCP in LabVIEW, they're not exposed. However, you can get the remote port and IP address when you use "TCP Wait on Listener". When a new connection is established, you get those properties along with the connection ID. Quote Link to comment
Jarimatti Valkonen Posted December 9, 2008 Author Report Share Posted December 9, 2008 QUOTE (normandinf @ Dec 8 2008, 05:18 PM) You can't access any properties or methods for TCP in LabVIEW, they're not exposed. However, you can get the remote port and IP address when you use "TCP Wait on Listener". When a new connection is established, you get those properties along with the connection ID. Thanks for the reply. Unfortunately I'm the active side of the connection, but it seems that I must rethink my program about this. For the curious: I'm using direct ADS communication via TCP with Beckhoff BK9000 Ethernet bus coupler. The implementation is pure LabVIEW, no additional ingredients are needed. Digital and analog I/O works as a treat, as does some more special terminals and register reading/writing. The ADS communication uses a special AMS header, which contains various stuff, one of them being the AMS NetID of the sender and receiver. The NetID is currently composed of the IP addresses of the communicating parties, so I would have liked to create it on the fly. On the other hand, I can easily include the connection refnum in the AMS header cluster and use it for the TCP operations. Quote Link to comment
Phillip Brooks Posted December 9, 2008 Report Share Posted December 9, 2008 You can get access to the raw socket using vi.lib\Utility\tcp.llb\TCP Get Raw Net Object.vi I did something similar to get access to the UDP socket. I used this to increase the default OS buffer size for a UDP receiver that was overflowing the default size (8kB as I remember). http://forums.ni.com/ni/board/message?boar...ssage.id=232025 Just be aware that LabVIEW doesn't know what you're doing to the socket, so tread lightly Quote Link to comment
Mark Smith Posted December 11, 2008 Report Share Posted December 11, 2008 QUOTE (Phillip Brooks @ Dec 8 2008, 11:08 AM) You can get access to the raw socket using vi.lib\Utility\tcp.llb\TCP Get Raw Net Object.vi I did something similar to get access to the UDP socket. I used this to increase the default OS buffer size for a UDP receiver that was overflowing the default size (8kB as I remember). http://forums.ni.com/ni/board/message?boar...ssage.id=232025 Just be aware that LabVIEW doesn't know what you're doing to the socket, so tread lightly I'm a little late to this thread, but I have to admit I did not know you could get the socket handle from a LabVIEW function (thanks for the info Philip!). My TCP IPv6 toolkit in the Code Repository already uses the socket handle as the connection ID, so one can use this LV function to get the socket handle and then connect to any of those VIs. I never thought about returning the socket properties until this thread, but it seems like it could be useful so I added the following (from the ReadMe for this toolkit) "GetType, Get Address, and GetPort functions - these functions take a socket handle and return the type (IPv4 or IPv6), the connected address, and the connected port. These may be used as part of this toolkit or can be used to return the same information from the native LabVIEW TCP/IP toolkit (Windows only). One needs to get the socket handle using the "TCP Get Raw Net Object.vi" found in "vi.lib\Utility\tcp.llb". Pass the Raw Net Object (socket handle) into these VIs." Mark Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.