System.Net.Socket.TSocket

From RAD Studio API Documentation
Jump to: navigation, search

System.TObjectTSocket

Delphi

TSocket = class

C++

class PASCALIMPLEMENTATION TSocket : public System::TObject

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:

  1. Bind your socket to a local adapter.
  2. Configure your socket to start listening for incoming connections.
  3. Accept an incoming connection.
  4. Exchange data with the remote socket:
  5. Close your socket.

Using a Socket as a Client

To use your socket as a client socket:

  1. Connect your socket to a remote socket.
  2. Exchange data with the remote socket:
  3. Close your socket.

See Also