Jump to content

Why doesnt TCP listen listen to my IP address


Recommended Posts

I ran the the simple TCP project from the examples. You can find it in examples under networking, under TCP & UDP as Simple TCP.lvproj. I ran the program and it works. In the program its trying to connect to port 6340 of local host in client and listening to 6340. Local host as you know would be 127.0.0.1 in every PC. So that works. I changed the program from local host to a static ip address I set and to one of the open ports under that IP and in server I tried to listen to that port and when I run the program the client works. Its connecting to static IP and open port correctly, but my server program doesnt work. TCP listen just keeps waiting for a connection and then timesout. But client had already established a connection but server is unable to listen to it. Why is this? What is the problem that is preventing TCP listen from listening to the connection made to my static IP. I also watched a youtube video and did the exact the same program in the youtube video to see. 

https://www.youtube.com/watch?v=fJ_fEoBHoFw&list=PLj94YLX50Wtn7XvVG4Pa58M0HGs4o62r1&index=1

In the youtube video the person is able to make it work, but when I do it in my PC, same problem. Client makes connection but TCP listen cannot listen to that connection in server. I have uploaded that code here as well. Can someone explain to me why is this so? Thank you. 

TCP from online.vi

Link to comment

@ShaunR, thats not the problem. I tried other ports as well. I have changed the same program to 45321 port and it doesnt work. 8006 port is not free for my static IP address. Its unable to make a client connection to 8006. So I am not using that. I tried 45321 now and same problem. I have done the same thing with another project with 62255 and same problem. When I had this problem there, that is why I tried testing with example project and also with the online video i coipied. Same problem everywhere. TCP listen is unable to make connection to the port of my static IP which the client makes connection to. That is what needs to be fixed. 

Link to comment

I found out the problem was port. So I am not sure how port works. So the port which I was working on earlier didnt work. But my colleague came and suggested 80 which is the https port and is always open and it worked. And then my colleague was saying that there are different ports used by labview and I need to try one of them, I dont understand how that is. So I picked this port 45321 by using netstat -ano and my colleague is saying maybe labview doesnt connect to that. So I did this new way where I wrote a seperate client server program just for connection, where I used a service name on Wait on Listener and gave port as 0 to get a random port. And I got that port as 58411. Now I used 58411 on my original progam and it worked. So 58411 is working.

 

So this comes to the initial issue which made me work on all this example in the first place. And that is connecting between two PCs. So now client is another PC and server is in this PC. So I gave my IP address and port number 58411 to the client PC and now client PC is not connecting. This was working when both client and server were in same PC, but now when I changed client to a different PC it is not working . If I use the 45321 from earlier then client will connect but server wont listen to it, doesnt matter if client and server are in two pcs or same pc, client will connect to 45321, but server will not listen in either case. If i use 58411, not even client is connecting, but 58411 will work when client and server are both on same PC and in this condition both client will connect and server will listen. So now I am not sure, how do I find the correct port number for working with two different PCs. Are there special port numbers for labview. This is really confusing. Thank you. 

Link to comment

Sounds like on your computer port 45321 is already in use by some process (not necessarily labview). Besides, 45321 is still in the IANA range, whereas 58411 is already in the Dynamic range.

https://stackoverflow.com/questions/133879/how-should-one-go-about-choosing-a-default-tcp-ip-port-for-a-new-service

https://www.baeldung.com/cs/default-port-network-service

On top of that, you may have lingering.

Link to comment

Its been a week, but i actually found the solution. The solution is here :

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019Lz2SAE&l=de-DE

 

In there it explains 

  • You can also try navigating to Tools»Options»VI Server and adding * to the Machine Access List by choosing Add at the bottom, entering * in the Machine name/access field, and ensuring that Allow access is selected. However, this will grant all machines access to the target machine.

By doing this, I got access. I found a port by using 0 and service name and finding a open port for program to work.

 

But what still I dont understand is different from the ports which i found is open via cmd window. In cmd window when I typed netstat -ano, it gave me a list of ports which are open and not open. And the port i found through the method above is not in this list. And the port that was open in the list from cmd window, one of the example being 45321 doesnt work also. So why is that? That I still dont understand. But thankfully, I was able to set the program working. 

Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.