TCP COMMUNICAT​ION ON INTERNET
Hello..
There is one example "TCP communication client-server model" in example finder. I have tested it. It is running on local LAN connection.
What should I do to run it on internet...
Please let me know
Thanks
Prashh
The only thing you need to change to run that example across the world, rather than across the room, is the IP addresses.
Your machines have to have internet access to the outside world, of course.
I have a couple of blog entries describing the basics of TCP communications:
http://culverson.com/category/tcp/
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks
Similar Messages
-
TCP communicat​ion temporaril​y dies
Hi There
Im using TCP to communicate between my ARM processor and PC. However, the communication sporadically dies for 3 to 4 seconds and then resumes, as shown in the Task Manager Networking (attachment 1) . This happens with the simplest of test programs, as shown in the attachments, and no delays or sequences seemed to solve the issue.
After some duration the communication dies completely with error code 66.
What is causing the delays in communication and is there a fix for this?
Attachments:
simple TCP failure.jpg 527 KB
Simple Server - ARM.jpg 72 KB
Simple Client - PC.jpg 74 KBHey,
What kind of delay did you add into the VI? it sounds like a pretty classic case of reading and writing TCP too fast. You may want to take a look at this article: http://digital.ni.com/public.nsf/allkb/4CB799F36D0EA56A862576200064B2F9?OpenDocument
Regards,
Eric L.
Applications Engineer
National Instruments -
How to handle threading for TCP communicat​ion?
Hi,
I've a project to control two separate applications (C++ and LabView) and both of them are implemented as server. Another client program (C++) is used to control those application. The communication among them are implemented using TCP socket. The client program sends message to start or stop some tasks on the servers. The client program also sends time (hh:mm:ss) with the start and stop message to determine when to start or stop.
In C++ application (server): The application listens for connection and when gets one, it creates a communication thread to handle that and again listen for another connection. The communication thread handles message passing and when it receives start or stop message, it creates a timer thread with the received time to trigger a task at specified time. And after that it waits for message from the client. So, here, when thread (communication, timer) is needed, it is created.
In LabView (server): I've tried to create same thing as the C++ server. But, from LabView manual and others forum threads, I got that LabView is multithreading and it can be done using independent loop. So, I'd to create four loops in a diagram:
1. Listen for new connection
2. Handle communication for already received connection
3. Start timer
4. Stop timer
and they are run at the beginning of the execution and communication among them are managed using local variables. But, 2,3 and 4th loop can handle only one connection and it can handle another if the current is closed. But, the C++ application can handle more than one connection by creating thread when it is necessary but not at the beginning of the execution of the application.
Is there a better way to implement this in LabView?
Is it possible to handle multiple connections and create diagram node/block (like thread) dynamically like C++?
Thanks.
Using LabVIEW 2010, Visual C#, Visual C++ (2005, 2008, 2010)
Solved!
Go to Solution.There are several ways to do this in modern LabVIEW and you should probably search the Example Finder for some TCP examples. The classic way is to transfer the connection refnum from the listen loop to a communication loop that adds it to an array of connection IDs and then continously iterates over this array to do the communication. It works since about LabVIEW 4.0 perfectly for me even for applications with HTTP based communication protocol. But you need to make sure of course that the communciation handling for one connection isn't delaying its work for some reasons as that would delay the handling of the other connections too, as they are really worked on sequentially. If you encounter an error, the connection ID is closed and removed from the array.
The other is that you create a VI that does your whole communication and terminates itself on an error or when getting the quit command. Make this VI to be reentrant and then launch it through VI server as reentrant instance, passing it the newly received connection refnum form the listen loop. Then use the Run method to let it start and operate like an independant thread.
For all of these you should be able to find an example in the Example Finder when searching for TCP.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
RIO hangs up when tcp communicat​ion begins or ends
Hello,
i'm working on a RIO targeted application that makes use of the STM2 library to send acquired datas to the host via TCP calls. The RT vi on the RIO, and the Host vi that receive the datas periodically check for a working tcp connection, to make it work whenever the RIO or the host was first powered on. The only trouble i get is that the RT application hangs up for a few seconds, even the highest priority timed loop, when the connection starts or ends. Is it an expected behavior ? Is there any mean of avoiding that ?
Thanks for any idea !
Vincent
PS : I use :
LabVIEW 8.6.1 package
STM library 2.0
9014 RIO controller running RIO 3.1 software
VincentHi VdG,
Sorry for
the late answer but I was unavailable this week. Well, on the cRIO controller there
is a RT OS and normally we don't consider the communication with the host as a
high priority task. You can implement Producer/Consumer architecture on your RT
Target where the Producer contains the high priority task and the consumer the
communication task with a less high priority. If you implement the
communication in the highest priority loop it will cause the cRIO VI will wait
for the communication is establish to run anything else.
You can
find here good
programming practices for RT application.
Hope this
helps and feel free if you have any other questions.
Benjamin R.
R&D Software Development Manager
http://www.fluigent.com/ -
Tcp open connection problem while parallel tcp communicat​ion
I have a problem with TCP Open connection while running another TCP transfer.
While I run the Simple Data Client/Server example (..NI\LabVIEW 2010\examples\comm\TCP.llb) I would like to open another TCP connection according this simple VI attached. This runs on another port than the running Client/Server example. When the address of the PC to be connected to, is known to the network (IP/Name) all is fine, when the address is a name unknown to the network, than a significant delay in the datatransfer of the client/server example occures. Hope that anybody can reproduce/explain this behaviour.
Network setup here is Gigabit ethernet/ DHCP / Windows XP Prof. SP3/ LV 2010 / LV 8.6.1
Jörn
Attachments:
TCP_Open_blockingproblem.vi 16 KBI really appreciate your comments,
to make sure that we do see the same effects let me exactly explain what I see: I open the example vi's : Data Client/Server example (..NI\LabVIEW 2010\examples\comm\TCP.llb. You can open it localy that means on one PC or open one on another PC. To make it simple for the first try open it localy and run both vi's according the example instructions. On the Data Client.vi I see now the samples updating many times per second (should be every 25 ms, because the server produces these in this intervall). All is like expected. Now open the TCP_Open_blockingproblem.vi from above and let it run unmodified (except you have an PC named 'DataServer0'). What I see now in the Data Client.vi : The samples update came nearly to an halt (this is why I called it 'blocking'). Updates only every 6 seconds (here in my network setup). Now stop the TCP_Open_blockingproblem.vi. The DataClient.vi is running on the same speed as before. Now modify the 'DataServer0' to a pc name existing in your network and start again. This time the sample speed is not degraded. Can you confirm this behaviour ?.
I did recognise the effect for the first time while I desigend an appliaction based on the STM library and posted the effects I saw, here : http://forums.ni.com/t5/Components/Simple-TCP-Messaging-STM/td-p/583438/page/5. Like Christian Loew supposed there is a bunch of code around. It is a multi tier application receiving TCP traffic on some ports and distributing on others. So I decided to isolate the problem from STM and my own code and came to the simplest code which I thought it was possible where the problem still occures which I described above.
Your suggestion to lookup the names once in the beginning of the application is a possible way, but I must say with the experience now I am still very uncertain of more unexpected future side effects during lookup, especially on network setups at customersites where I have no direct access. So I decided to give an UDP registration mechanism a try, like it is realised in the STM Examples of HostReceiver.vi and Target Sender.vi.
Thanks for following so far,
Jörn -
TCP communicat​ions via C program with VI on a PC (SGI - Windows)
I have a pair of simple (more at prototype) client/server C programs on an
SGI host. On the SGI, they compile and run fine (using separate windows).
I know what the server is supposed to be sending (C floats) and the client
is reading the correct values.
I now want to start my C program server on the SGI host, and use the Simple
Data Client.vi (in LabVIEW 6.1's examples) to display (in its graph) the
floating point values that the SGI host is sending.
So far, I have not had complete success. If I start my SGI server, and
"point" the example Simple Data Client VI at my server, the LabVIEW client
gets immediate errors (overflows).
As an experiment, I tried going the other way. That it, I started up
the
Simple Data Server VI on the Windows PC. I then "pointed" my SGI client at
the server on the PC. It works, ... sort of. I am getting an
appropriately sized list of numbers displayed on the SGI host, but while
most look like floating point values, some look like VERY large integers.
I believe I have a data representation problem. That is, I don't know if I
should expect to send (server-side) or see (client-side) C programming
variables of type 4-byte floats, 8 byte doubles, or something else. Also, I
am not certain how many values I should expect to send/see in each message.
I think the default for the Simple Data Client/Server programs is 200
points, but I am not sure what that really means, either.
Any suggestions would be very much appreciated.
Mike McCormick
Michael J. McCormick
Phone: 520-545-7972
Fax: 520-794-9400
Email: [email protected]> As an experiment, I tried going the other way. That it, I started up the
> Simple Data Server VI on the Windows PC. I then "pointed" my SGI client at
> the server on the PC. It works, ... sort of. I am getting an
> appropriately sized list of numbers displayed on the SGI host, but while
> most look like floating point values, some look like VERY large integers.
>
> I believe I have a data representation problem. That is, I don't know if I
> should expect to send (server-side) or see (client-side) C programming
> variables of type 4-byte floats, 8 byte doubles, or something else. Also, I
> am not certain how many values I should expect to send/see in each message.
> I think the default for the Simple Data Client/Server programs is 200
> points
, but I am not sure what that really means, either.
>
By default, LV converts all of the datatypes to be in big endian form.
I'm not sure about your SGI, but if it is a little endian machine, then
that will cause problems. If that is the case, you will want to swap
the words and bytes of the four byte values.
To debug this more easily, you might just make sure you send over very
predictable data such as 0, 1, 2, 3, etc. Lots of times these are
tested with random data, but that makes it pretty hard to see a pattern
when the data is wrong.
Greg McKaskle -
"Letting Adobe Flash communicate with the internet"
Ok, Here is the deal. I have some .flv video files hosted on my domain with a fantastic looking flash player. It all works great. Except that every time that I change any of the code in the html snippet, or load the page with said snippet on it in iweb, i get this message:
"Adobe Flash Player has stopped a potentially unsafe operation.
The following local application on your computer or network:
iweb-widget:58/$x-html-markup
is trying to communicate with this Internet-enabled location:
my.domain
To let this application communicate with the internet, click settings.
You must restart this application after changing your settings
{OK} {Settings...}"
and here's where my problem comes in. I can click ok, and it apparently just ignores the "security" risk and lets it go through that one time, but the next time I load up the page, I have to do it all over again.
Alternatively, I can click settings, and exactly the same thing happens as when I click ok.
Any idea how to get this message to go away. I understand what the "security" risk is, but I also know exactly what it is that I am hosting and I want to allow it to communicate with my webserver.
For reference, here is the code in my html snippet
"<embed
src="http://my.domain/mediaplayer/player.swf"
width="640"
height="352"
bgcolor="000000"
allowscriptaccess="always"
allowfullscreen="true"
flashvars="file=http://my.domain/movies/shortclip.flv&backcolor=000000&frontcolo r=EEEEEE&lightcolor=000000&screencolor=000000"
/>"
For clarification, when published and uploaded, every thing looks great and runs as it should, but I really hate this amazingly annoying nag message.I am already using the JW Flash player.
http://www.jeroenwijering.com/?item=JWFLVPlayer
same thing as the link.
That part is working fine. I just need to know how to change the settings so flash player doesn't get angry about it contacting an external site.
Just kind of annoying that every time that I even load up the page to view it in iweb, I have to click to let it contact the external page, for every video on the **** page. -
Hi folks
I have a really annoying problem: I want a computer (Win XP, Ethernet board, Labview 7.1) to communicate with my robot controller (Win 2k, Epson SPEL+ language). The robot controller is the client, the LabViewPC the server. now reading messages sent by the robot controller are no problem to read. But when I want to send messages from the LabViewPC to the robot controller I get an error message: error ni-448, make sure that the GBIP-controller is the primary controller.
For the communication I open a TCP-listener and a TCP wait listener in a while loop. So far this works. Then I use the TCP-write function to send a string to the robot controller. Here the error described above occurs. So the communication doesn´t work.
Can anybody help me?
Please. Thank you in advance!hi there,
are there several network adapters on your host? if so pass the IP of the network adapter to the "TCP listen.vi". i'm not sure but i think i remember that in former versions this had no effect. then you could use "TCP Listen.vi" on your slave and "TCP Open Connection" function on your host.
you can use the "Simple Data Server" and "Simple Data Client" examples for a quick test.
Best regards
chris
CL(A)Dly bending G-Force with LabVIEW
famous last words: "oh my god, it is full of stars!" -
Tcp/ip communicat​ion protocol
Hi All,
I've never done any Labview programming for TCP/IP as of late. But now I need to figure how to.
I've been asked to work on a Pick to Light system that is controlled via TCP/IP comm.
The Communication data is sent via a CCB (Communication Control Block) format as below.
The image below shows how to turn on a certain 7-segment LED to display a certain number.
What I'm trying to figure out is, how do you send the formated data via TCP/IP. As you know again, I've never worked with TCP/IP before.
I've done a ton of searching etc for how to send the data in a format that is similar to what the controller needs but have yet to find anything similar.
I'm not asking for you to do the coding for me, just need some guidance on how to.
I also attached the comm protocol for reference.
Thanks a ton in advanced,
guytesting
Attachments:
ABLEPick Communication Ptotocol (V2.4).pdf 2492 KBAside from the minor point that ATOP obviously didn't hire an English speaker to translate their manual, the documentation actually seems pretty good. The idea is that once you have established a connection, TCP/IP works a lot like a full-duplex serial link. You send packets and you receive packets.
For this family of devices there is a common protocol used that is documented in the manual. Some packets are like commands and only flow from the PC to the pickers. Some packets are data updates and only flow from the pickers back to the PC.
It appears that the manual gives examples of all packets using diagrams where each line visually represent one byte. For example, the first two lines are always the CCB length. Line 0 is the LSB, Line 1 is the MSB of a 16-bit byte count. So every packet will start with a 2-byte packet length.
MIke...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
TCP/IP communicat​ion
Hi everyone, i'm still new to labVIEW.
Can anyone tell me how i can transfer excel files to a remote PC through LAN? I've read the Basic TCP/IP communication manual and i am still confused.
Thanks!I would use a communication that the operation system supports. With Windows you can share a directory on the remote PC. There is an entry in the context menu of a directory. You provide a name to the share and may restrict the access. The help of Windows should help further.
The shared directory is accessible from other computers now. The path to save the Excel file is: \\remote\share\Excelfile.xls
(remote: name of remote computer, share: name of share, Excelfile.xls: name of the Excel file)
I hope this helps.
Greetings
shb -
Problème avec communicat​ion TCP
Bonjour à tous,
J'essaie de faire communiquer 2 PCs (un serveur et un client) par TCP via LabVIEW mais ça ne marche pas.
J'aurais voulu donc vous montrer ce que j'ai codé afin que vous me disiez s'il y a des erreurs de codage.
Pour l'instant je veux envoyer la commande NULL qui interroge le PC
serveur sur son état. Celui ci renvoie alors normalement un message de
statut (écrit en XML) par TCP au PC client sur lequel se trouve LabVIEW.
Lorsque j'exécute mon code le logiciel sur le PC serveur (qui doit
normalement me renvoyer le msg de statut) sort une erreur : "Une
opération a été tenté sur autre chose qu'un socket. Could not process
the command NULL".
Ma question est alors est : y a-t-il un problème avec mon code LAbVIEW
ou est ce un problème de configuration réseau sur le PC Serveur ?
Merci beaucoup,
A++
Attachments:
test3.GIF 17 KBMalheureusement, je n'ai pas d'experience avec LabVIEW et l'utilisation de sockets.
Je craint que cela ne soit pas facilement possible, suite de la lecture de cette proposition d'idee:
http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Access-to-sockets-other-than-TCP-UDP/idi-p/1481952
Cependant, voir cette discussion qui inclus un exemple:
http://forums.ni.com/t5/LabVIEW/Implementing-Data-Sockets-and-Ports/m-p/45775 -
Bi direcional Client/Ser​ver communicat​ion over TCP/IP
Could someone suggest me a tutorial about Bi direcional Client/Server communication over TCP/IP in LabView?
Thank you in advance.I would start by looking at the examples included with LabVIEW.
Look in examples\comm\TCP.llb
Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.
"You are what you don't automate"
Inplaceness is synonymous with insidiousness -
LabVIEW - Activex Internet Explorer Communicat​ion - Question
Hi
I have a code which can generate a URL(https:\\.....) to talk to a
server. The server in turn sends my code a response. I've used ActiveX
to enable the communication over a secure network.When I make a change
in the URL I send to the server, I expect a different response. However
there is a delay in reading that response. If I use the same URL in the
web browser I get the correct message. Looks like ActiveX is caching
the data. Has anyone faced this problem before and what might be a
potential solution ? Thanks for your help.
Thanks
Kudos always welcome for helpful postsAttached is a snapshot of my program. I think activex might be
cacheing. but i am not sure which component. probably the one which
tries to navigate the IE - that's my best guess. Let me know if you
have suggestions.
Thanks
Kudos always welcome for helpful posts
Attachments:
program.jpg 891 KB -
I have developed a small .NET Desktop application which hosts a TCP service. In addition, it sends UDP Multicasts to anounce that service.
Service consumer is a Phone 8.1 app, which listens for these UDP multicasts and when it receives such a multicast, it creates a TCP connection to the service.
The following snippet shows how the Phone 8.1 app listens for UDP packets and then connects via TCP
const string UdpPort = "42";
const string TcpPort = "43";
const string MultiCastIp = "224.5.6.7";
const int TimeoutForServerLookup = 10000;
//-- listen for UDP multicasts
HostName hostNameOfServer = null;
var udp = new DatagramSocket();
var clientFound = false;
udp.MessageReceived += delegate(DatagramSocket sender, DatagramSocketMessageReceivedEventArgs args)
try
hostNameOfServer = args.RemoteAddress;
catch (Exception ex)
s_Log.Error("Error in handling UDP packet", ex);
await udp.BindServiceNameAsync(UdpPort);
udp.JoinMulticastGroup(new HostName(MultiCastIp));
var waitedTimeInMs = 0;
const int delayInMs = 250;
while (waitedTimeInMs < TimeoutForServerLookup && hostNameOfServer == null)
waitedTimeInMs += delayInMs;
await Task.Delay(TimeSpan.FromMilliseconds(delayInMs));
udp.Dispose();
//-- we now have the adress of the TCP server (hostNameOfServer)
//-- connect now to the server. this works when being in a "normal" WLAN, does not work when the phone is the hotspot
var socket = new StreamSocket();
await socket.ConnectAsync(hostNameOfServer, TcpPort);
This works well when the Desktop computer and the Windows Phone 8.1 are within the same WLAN. For some customers it is important that this also works when the Windows Phone 8.1 acts as hotspot (by enabling internet sharing on the phone) and the desktop computer
(or Laptop) connects itself to this WLAN. In this scenario the Phone 8.1 still receives the UDP packets, but when trying to connect via TCP, the connection attempt fails.
Any ideas how to get rid of this problem?Have you tracked down if the phone actually sends the TCP connection to the desktop? I'm feeling that this is a firewall issue that shows itself when the firewall zone changes (public/private/domain).
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
objects and unknown namespaces. -
Interproce​ss Communicat​ion C++ - LabView
Hi,
I have a C++ *.exe file wich is grabbing images with a Matrox framegrabber. This program ist startet via "system exec" from LabView. I want to do a kind of time measurement with this program so i need the exact time when the grabbing of frame starts. At the moment I dont know how long the *.exe file needs to initialize the framegrabber (something about 500-1000ms).
My idea is to start a continous grabbing but start saving the images when another command via LabView will be send to the C++ application. But I don't know how to send this command! It should be a kind of a "wait until key pressed" controlled by LabView. Maybe a global bolean or something like that.
I hope somebody can help me!
(programming with LabView 7.0 and Visual C++ 2003.NET)Hi,
What
you are looking for is called an “inter-application communication”.
There
are several options to realize it. LabVIEW supports TCP/IP, ActiveX or UDP to
communicate with another application. So
it’s not as simple as using a “global Boolean”
as you mentioned.
I advise you, to use the LabVIEW
examples which shipped with the NI example finder to get some programs as
reference. Search for keywords like TCP/IP, ActiveX and UDP.
Attached
you’ll find a link to a knowledgebase.
Hope this helps.
How Do I Use LabVIEW to Communicate with Other
Applications?
http://digital.ni.com/public.nsf/allkb/B3959ED76D55A9E586256965004D8092?OpenDocument
Regards,
Ulrich
AE NICER
Maybe you are looking for
-
Hi guys.Got a problem with my iPhone 5. I bought it in a shop 4 month ago. After I got a visitor with iOS 7 on his phone he would like to charge his phone with my Laptop and cable.But when he plugged it in it showed a message wich says: " This cable
-
Hi One month before I stated the question > Why do I need the an alias spfileDBNAME.ora to *ASM-File +DATA/DBNAME/PARAMETER/spfile..* > in a RAC-Environment. Levi Pereira gave me kindly the answer in the Thread: Re: RAC Backup + Restore & Recover Bu
-
Administrator name and password does not work in other accounts
My hard drive died so I had one installed. I reinstalled contents from TimeMachine. When my son is in his account and he is prompted for the Administrator's name and password I type in the required info but the shaking text box indicates that my admi
-
Scaling percentage images inside InDesign
hi, got an image with a size of 544 x 408 px meassured in photoshop. Safe it as layered .psd at 264dpi. Bring it to InDesign where I create articles for a 1024 x 768 px folio. At 100% the image meassures 101.489 x 96.233 px. Think it's a resolution i
-
HT3739 accidentally removed stacks from dock
How do I get it back?