System.Net.Socket.TSocket
Delphi
TSocket = class
C++
class PASCALIMPLEMENTATION TSocket : public System::TObject
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
class | public | System.Net.Socket.pas System.Net.Socket.hpp |
System.Net.Socket | System.Net.Socket |
Description
Represents a network socket.
To create a socket, you can call Create and specify the type of your socket and the encoding of the data that your socket sends and receives.
Once you have a socket, you can use it either as a server or as a client.
You can close your socket at any time to stop using it temporarily. If your application is no longer going to use a certain socket, you can destroy your socket. The destructor of your socket closes the socket automatically.
Using a Socket as a Server
To use your socket as a server socket:
- Bind your socket to a local adapter.
- Configure your socket to start listening for incoming connections.
- Accept an incoming connection.
- Exchange data with the remote socket:
- Receive data from the remote socket.
- Send data to the remote socket.
- Close your socket.
Using a Socket as a Client
To use your socket as a client socket:
- Connect your socket to a remote socket.
- Exchange data with the remote socket:
- Receive data from the remote socket.
- Send data to the remote socket.
- Close your socket.