LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP data from host to peripherical

Hi, I try to comunicate from host to RFID reader, How I can comunicate from host without a previus conection from the reader? Usually the comunication is done from reader to host, then it is created a handle conection, so you can send any datas, but this reader has two ports, 10001 comunication reader to host and 10002 comunication host to reader, my problema is How I do this comunication? with this function RegisterTCPServer (SERVER_PORT_NUM, ServerCallback, NULL), the program listen the port and when the reader send any data, the program can do it. But however, otherwise I want comunicate by other port 10002 to reader, How I can open the port and obtain the handle conection? Thanks a lot.
0 Kudos
Message 1 of 7
(4,323 Views)

Connection to a TCP server takes place when a client connects to a specified port number on a server that is listening on that port. The server's replies to the client are generally made to an anonymous port number at the client end.

 

If your device insists on a specific port number to be used, then from the host CVI's perspective it is a server (for that particular channel of communication - there is nothing preventing multiple clients/servers at both ends of a network link). In that case, use ConnectToTCPServer(), with the port number of 10002 to obtain another handle. You can then use ClientTCPWrite() to send data via the new handle, and ServerTCPRead() as before to read using your original handle.

 

JR

0 Kudos
Message 2 of 7
(4,289 Views)

I show you the program, so is easy to understand me better,

1º RegisterTCPServer( 10002, ServerCallBack, NULL); -> I listen the in port host, only listen.

2º RegisterTCPServer( 10001, ServerCallBack, NULL);  -> I open this port to send commands to the reader, by example "open relay"

The problem is that the events received from the comunication is always began by the reader to obtain the "Handle" with event TCP_CONNECT, so you obtain the handle.

The reader always comunicate port 10001 - IP 192.168.10.10 to write, host -> reader and to comunicate for read is port 10002 - IP 192.168.10.1(host) , reader -> host. 

Ok, you say to comunicate the reader like a server with function ConectToTCPServer, I'd tried to do it, but the answer is Timeout, not comunicate.

May be could you please a little example to understand better.

Thanks again.

0 Kudos
Message 3 of 7
(4,272 Views)

In your first message:


Agapito wrote:

...

10002 comunication host to reader 

...

In your second one:


Agapito wrote:

...

to comunicate for read is port 10002 - IP 192.168.10.1(host) , reader -> host. 

...

It is vitally important to get these numbers correct, or else the system won't work. Is there a website where we can see a datasheet or user manual for the device you are using?

 

JR

0 Kudos
Message 4 of 7
(4,267 Views)

Yes, you're right, I'd had a mistake.

Host - IP 192.168.10.1 Port 10002 - Listening data from reader

Reader - IP 192.168.10.10 Port 10001 - Sending and listening, host->reader & reader->host, comunication & configuration

I do a Ping IP 192.168.10.10 from host, yes there is, but from my software I can't to open the port to write. 

I'd attached a file with the protocol, look for page 43.

Thanks always.

0 Kudos
Message 5 of 7
(4,249 Views)

Much as I'd love to spend many hours reading a 148 page technical manual on an unfamiliar technology (RFID), I'm afraid I don't have that kind of time to spare. I will make a few points on it, though. First, in para.1.1 on page 10 there is mention of demonstration software and an SDK being available. Have you looked at this sample code to give you an example of the recommended communication? Second, there was mention somewhere of an automatic network disconnect at the reader end if communication was not achieved within 15 (?) seconds - this might be tripping you up. Third, I did a search of the manual for the numbers you mention and the value 10002 is not in the document. Smiley Wink

 

It seems to me that you are struggling with two unfamiliar areas; TCP on CVI and working with the Reader device. Why don't you write a second CVI TCP program, that simulates (at a very basic level, obviously) the communication protocol. Then you can run this on a second PC networked to the first and use it to check out the TCP operations. (Or, as I tend to, run several programs on one PC using localhost connections to implement the TCP communication.) This could reveal any basic misunderstandings about clients, servers, handles etc and then you could continue with your real hardware with confidence that the basics were OK.

 

JR

0 Kudos
Message 6 of 7
(4,232 Views)

I understand, page 43 say the IP configuration of the reader, port 10002 is into the configurator program only. The SDK is available only paying, and I want to do something really simple, read a RFID tag and later open a relay, the SDK is very good for development a great program.

I'm going to do the other CVI program to simulate protocol comunication, good idea.Smiley Happy

I'll tell you when I've done it.

 

0 Kudos
Message 7 of 7
(4,230 Views)