11-14-2009 06:10 AM
11-17-2009 08:54 AM
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
11-18-2009 02:39 AM
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.
11-18-2009 03:55 AM
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
11-18-2009 12:07 PM
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.
11-19-2009 03:41 AM
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. ![]()
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
11-19-2009 04:28 AM
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.![]()
I'll tell you when I've done it.