While TCP/IP communications (and collecting data from TCP/IP devices) can appear to be daunting at first, it is actually a very simple communication tool.
TCP/IP stands for “Transmission Control Protocol / Internet Protocol”. It is basically a network protocol that defines the details of how data is sent and received through network adapters, hubs, switches, routers and other network communications hardware. It was developed by the US department of defense for the purpose of connecting government computer systems to each other through a global, fault tolerant, network. The defense department network was opened up to research institutions and eventually the general public to create what is now the Internet. The TCP/IP protocol was also placed in the public domain so that any software company could develop networking software based on the protocol. Because it is the primary protocol used on the Internet, and it is in the public domain, it has become the most popular networking protocol throughout the world and is therefore well supported by almost all computer systems and networking hardware.
The TCP/IP protocol is designed such that each computer or device in a network has a unique "IP Address" (Internet Protocol Address) and each IP address can open and communicate over up to 65535 different “ports” for sending and receiving data to or from any other network device. The IP Address uniquely identifies the computer or device on the network and a "Port Number" identifies a specific connection between one computer or device and another (i.e between two IP Addresses). A TCP/IP "port" can be thought of as a private two-way communications line where the port number is used to identify a unique connection between two devices. The concept is very similar to any other type of port on your PC (serial, parallel, etc) except that instead of having a physical connection, the TCP/IP protocol creates a "virtual IP port" and the network hardware and software is responsible for routing data in and out of each virtual IP port.
TCP/IP connections work in a manner similar to a telephone call where someone has to initiate the connection by dialing the phone. At the other end of the connection, someone has to be listening for calls and then pick up the line when a call comes in. In TCP/IP communications, the IP Address is analogous to a telephone number and the port number would be analogous to a particular extension once the call has been answered. The “Client” in a TCP/IP connection is the computer or device that “dials the phone” and the “Server” is the computer that is “listening” for calls to come in. In other words, the Client needs to know the IP Address of whatever Server it wants to connect to and it also needs to know the port number that it wants to send and receive data through after a connection has been established. The Server only has to listen for connections and either accept them or reject them when they are initiated by a client.
Once a connection through a TCP/IP port has been established between a TCP/IP client and a TCP/IP server, data can be sent in either direction exactly the same way that data is sent through any other type of port on a PC (serial, parallel, etc.). The only difference is that the data is sent across your network. The connection between a Client and a Server remains open until either the client or the server terminates the connection (i.e. hangs up the phone). One extremely nice benefit of the TCP/IP protocol is that the low level drivers that implement the sending and receiving of data perform error checking on all data so you are guaranteed that there will be no errors in any data that you send or receive.
The above description is extremely basic and is meant to describe the general concepts of how TCP/IP communications works at the simplest conceptual level. To learn more, use your favorite Internet search engine to search for the term “TCP/IP protocol”. You will find countless articles that discuss the intricate details of the TCP/IP protocol.