LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP client/ server over network

Hello

 

i have PXIe8130 controller i wan to send data form my controller to different clients( e.g 6 clients) using a switch between

clients and server(controller). what are the port no and what should be th Ip address. e.t.c . I am a little blind on this side 

if any one could explain that. Or. it is the same as client server vi in labview example finder......... i put my server network cable to my switch and client's will be given the Same Ip and same port no to access server through switch.......or wahatever? 

 

Regards

0 Kudos
Message 1 of 10
(5,142 Views)

It's up to you to determine what IP address range and port number to use.  If your switch is connected to some other network (for example, your university or corporate network), then you need to talk to your network administrator to get valid IP addresses.  If you're building an isolated network then you can use whatever you want.  A standard choice would be somewhere in the range reserved for private networks (192.168.xxx.xxx, 10.xxx.xxx.xxx).  Your controller and clients must have unique IP addresses.

 

If you're going to use the TCP or UDP functions to send data, you can use any port you want on the server, and then tell the clients to connect to that port.  It is a good idea to use a port number greater than 1024 to minimize conflicts with well-known services on lower-number ports.  You will need to write your server code so that it can handle multiple incoming connections on the same port.

 

LabVIEW provides many other ways to share data.  You may want to consider using shared variables or datasocket.
Message 2 of 10
(5,126 Views)

Actually if you are using your own port numbers you should use ports numbers that are greater than 49152 to ensure you don't have any port conflicts. If you use lower numbers you may not run into issues but the port numbers above 49152 are reserved for private and dynamic assignments. Here is an excerpt from the port assignment list maintained by IANA.

 

PORT NUMBERS

(last updated 2010-03-02)

The port numbers are divided into three ranges: the Well Known Ports,
the Registered Ports, and the Dynamic and/or Private Ports.

The Well Known Ports are those from 0 through 1023.

DCCP Well Known ports SHOULD NOT be used without IANA registration.
The registration procedure is defined in [RFC4340], Section 19.9.

The Registered Ports are those from 1024 through 49151

DCCP Registered ports SHOULD NOT be used without IANA registration.
The registration procedure is defined in [RFC4340], Section 19.9.

The Dynamic and/or Private Ports are those from 49152 through 65535

A value of 0 in the port numbers registry below indicates that no port
has been allocated.

 As mentioned you can choose your own IP addresses if you are on an isolated network. I would recommend using the subnet 192.168.1.x. Use a subnet mask of 255.255.255.0 for your devices. Each device should have a unique last number of the IP Address.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 3 of 10
(5,118 Views)

Hi

 

Tnx for the help. a meaningful one. But Out of the frying pan into the fire have connected my server with one client only having a switch between them(still a point to point topology but with a switch in the middle) Now I have to put a delay of 500ms on server side to receive data of just 1000bytes on the client side ,if don't do so(put delay) time line for the machine expires Whyyy. My switch is Foundry Networks 1.888.turbo Lan. While communicating between two PC's there is no need of delay and the rate at which loops on both sides running is far far more faster then client/switch/server Case. Where is so much backlog that i have to put such a big delay.... Any suggestion .....

 

Regards

0 Kudos
Message 4 of 10
(5,103 Views)
Can you post your code? Without seeing what you have it will be difficult to give you an answer.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 10
(5,086 Views)

Hello

 

Here i am attaching my simplest form of VI . The served client vi's are working perfectly fine as long as it is a point to point(ther is no switch in betweenserver and client ). loop iterates quickly. data on client recived at good speed.(if u put an indicator at data out u can see).I have checked this topology with sending at about 30MBytes. without puting any delay. But when i introduces Switch( i have mentioned above) between same client and Server. I have to put a delay of 400ms for sending and recieving just 1000Bytes.

 

Looking for ur response......?

 

Regards

 

Download All
0 Kudos
Message 6 of 10
(5,059 Views)

Hi madd,

 

I am not an expert on TCP/IP communication by any means, but wouldn't it be logical that the switch would introduce perhaps some bit of inefficiency into the system?

Stephen Meserve
National Instruments
0 Kudos
Message 7 of 10
(5,024 Views)

First, what are the network settings for both of your devices? Are either of your devices trying to do any type of DNS look ups which will impact your communication? Have you tried using a network analyzer such as Wireshark to see what is happening on the network? If you don't have Wireshark (or some equivilant) you should at least use NI Spy to monitor the traffic.

 

As for your client code, you should modify it to match what your server is sending. That is, your server is sending 4 bytes of the data length and then the data ittself. You should have your client read 4 bytes and then read the number of bytes specified by data length you just read.

 

I ran this on my system and I had no delay in the transmission. I piped over 30M of data through in a matter of seconds. I would check your network configuration as well as your switch. What type of switch are you using? Are you using good cables?



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 10
(5,015 Views)

I think this is a somewhat related question...

 

I would like to be able to programmatically control the function of my network card through LabVIEW. I want to be able to programmatically switch between connection to a wireless router and a direct connection to another computer via ad-hoc network. Furthermore, when the computer is connecting to the wireless router, I would like it to auto-detect the IP settings; but, when connecting to the ad-hoc network, I would like to manually specify the IP settings.

 

I'm doing this because it seems that any network card I've used can connect to a wireless router in just a few seconds when auto-detecting IP settings, but will take several minutes to connect to an ad-hoc network when auto-detecting settings. The connection to the ad-hoc network is made much more quickly (just a few seconds) when the IP settings of the host and client computers are manually configured.

 

Thanks,

Owen

0 Kudos
Message 9 of 10
(4,588 Views)

I thini you would have to go through .Net in order to do this. I don't know of any native LabVIEW primatives to change your settings.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 10 of 10
(4,586 Views)