RAD Studio |  |

Using server sockets
Collapse All
Topics

Name | Description
Closing Server Connections | When you want to shut down the listening connection, call the Close method or set the Active property to False. This shuts down all open connections to client applications, cancels any pending connections that have not been accepted, and then shuts down the listening connection so that your server socket component does not accept any new connections. When TCP clients shut down their individual connections to your server socket, you are informed by an OnDisconnect event.
Connecting to Clients | A listening server socket component automatically accepts client connection requests when they are received. You receive notification every time this occurs in an OnAccept event.
Listening for Client Requests | Once you have set the port number of your server socket component, you can form a listening connection at runtime by calling the Open method. If you want your application to form the listening connection automatically when it starts up, set the Active property to True at design time, using the Object Inspector.
Specifying the Port | Before your server socket can listen to client requests, you must specify the port that your server will listen on. You can specify this port using the LocalPort property. If your server application is providing a standard service that is associated by convention with a specific port number, you can also specify the service name using the LocalPort property. It is a good idea to use the service name instead of a port number, because it is easy to introduce typographical errors when specifying the port number.
Using Server Sockets | Add a server socket component (TTcpServer or TUdpSocket) to your form or data module to turn your application into an IP server. Server sockets allow you to specify the service you are providing or the port you want to use to listen for client requests. You can use the server socket component to listen for and accept client connection requests. Each server socket component uses a single server socket object to represent the server endpoint in a listening connection. It also uses a server client socket object for the server endpoint of each active connection to a client socket that... more

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!