RAD Studio
ContentsIndex
PreviousUpNext
Using client sockets
Name 
Description 
When you have finished communicating with a server application over the socket connection, you can shut down the connection by calling the Close method. The connection may also be closed from the server end. If that is the case, you will receive notification in an OnDisconnect event. 
Once you have set the properties of your client socket component to describe the server you want to connect to, you can form the connection at runtime by calling the Open method. If you want your application to form the connection automatically when it starts up, set the Active property to True at design time, using the Object Inspector
After completing the connection to a server socket, you can use the client socket object associated with your client socket component to obtain information about the connection. Use the LocalHost and LocalPort properties to determine the address and port number used by the client and server sockets to form the end points of the connection. You can use the Handle property to obtain a handle to the socket connection to use when making socket calls. 
Client socket components have a number of properties that allow you to specify the server system and port to which you want to connect. Use the RemoteHost property to specify the remote host server by either its host name or IP address.
In addition to the server system, you must specify the port on the server system that your client socket will connect to. You can use the RemotePort property to specify the server port number directly or indirectly by naming the target service. 
Add a TTcpClient or TUdpSocket component to your form or data module to turn your application into a TCP/IP or UDP client. Client sockets allow you to specify the server socket you want to connect to, and the service you want that server to provide. Once you have described the desired connection, you can use the client socket component to complete the connection to the server.
Each client socket component uses a single client socket object to represent the client endpoint in a connection.
Use client sockets to
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!