![]() ![]() For example, in the IndySock1 project group, I've used the two components with these settings: // server program object IdTCPServer1: TIdTCPServer DefaultPort = 1050 end // client program object IdTCPClient1: TIdTCPClient Host = 'localhost' Port = 1050 end Note The Indy server sockets allow binding to multiple IP addresses and/or ports, using the Bindings collection. ![]() Place one of them on a program form and the other on another form in a different program then, make them use the same port, and let the client program refer to the host of the server program, and you'll be able to open a connection between the two applications. Using Indy's TCP Components To let two programs communicate over a socket (either on a local area network or over the Internet), you can use the IdTCPClient and IdTCPServer components. Once the link is established, both sides are free to make requests and to send data to the other side. These different types of connections are important only for establishing the link from the client to the server. Server connections are activated by servers they accept a request from a client. (The client will connect through that port.). In brief, IP is responsible for defining and routing the datagrams (Internet transmission units) and specifying the addressing scheme. The heart of the Internet is the Transmission Control Protocol/Internet Protocol (TCP/IP), a combination of two separate protocols that work together to provide connections over the Internet (and that can also provide connection over a private intranet). Foundations of Socket Programming To understand the behavior of the socket components, you need to be confident with several terms related to the Internet in general and with sockets in particular. The first is used by default the second supports thread pooling and should account for faster connections. All the Indy servers use a multithreaded architecture that you can control with the IdThreadMgrDefault and IdThreadMgrPool components. Using blocking connections to implement a protocol has the advantage of simplifying the program logic, because you don't have to use the state-machine approach of non-blocking connections. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |