HttpClient
Overview
The HttpClient class represents a client connection to an HTTP Server.
For example: The Get method allows to retrieve a remote HTTP page specified via its Url as a String. Binary data, like an image, can be retrieved via the GetBytes method. Many of the HttpClient class properties map to a standard HTTP request header for easy reference.
The HttpClient class uses the HttpClientRequest class to send messages to the server and the HttpClientResponse class to receive the server answer.
This class is used internally by the IpHttpClientChannel to communicate with the server.
For more information about using the HttpClient class directly, see the Writing HTTP Applications using Internet Pack page, especially the Clients section.
Location
-
Reference:
- RemObjects.InternetPack.dll .NET, .NET Core 5.0, .NET Standard 2.0
- RemObjects.InternetPack.fx Island
- libRemObjects.InternetPack.fx Toffee
- Namespace: RemObjects.InternetPack.Http
-
Ancestry:
- Component | Client | HttpClient .NET, .NET Core 5.0, .NET Standard 2.0
- Component | Client | HttpClient Island, Toffee
- Component | Client | HttpClient .NET, .NET Core 5.0, .NET Standard 2.0
constructor
Creates a new instanse of the HttpClient class.
constructor
HttpClient()
init()
Sub New()
Abort virtual
Closes the currently open connection (if present).
method Abort
void Abort()
func Abort()
Sub Abort()
Accept virtual
Gets or sets content types that are acceptable for the response. The default value is "text/html, image/gif, image/jpeg, image/png, /".
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue('text/html, image/gif, image/jpeg, image/png, /')]
property Accept: String read write;
// Island
property Accept: String read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(\"text/html, image/gif, image/jpeg, image/png, /\")]
String Accept { get; set; }
// Island
String Accept { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(\"text/html, image/gif, image/jpeg, image/png, /\")
var Accept: String { get{} set{} }
// Island, Toffee
var Accept: String { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(\"text/html, image/gif, image/jpeg, image/png, /\")>
Property Accept() As String
// Island
Property Accept() As String
Binding virtual (declared in Client)
Obsolete - Please use BindingV4 and BindingV6 instead.
property Binding: Binding read;
Binding Binding { get; }
var Binding: Binding { get{} }
ReadOnly Property Binding() As Binding
BindingV4 virtual (declared in Client)
Gets the binding which provides properties and methods such as address family, IPv4 address, port number etc for client to connect to the host network.
property BindingV4: Binding read;
Binding BindingV4 { get; }
var BindingV4: Binding { get{} }
ReadOnly Property BindingV4() As Binding
BindingV6 virtual (declared in Client)
Gets the binding which provides properties and methods such as address family, IPv6 address, port number etc for client to connect to the host network.
property BindingV6: Binding read;
Binding BindingV6 { get; }
var BindingV6: Binding { get{} }
ReadOnly Property BindingV6() As Binding
Connect virtual (declared in Client)
method Connect: Connection
Connection Connect()
func Connect() -> Connection
Function Connect() As Connection
Connect (IPAddress, Int32): Connection virtual (declared in Client)
method Connect(host: IPAddress; port: Int32): Connection
Connection Connect(IPAddress host, Int32 port)
func Connect(_ host: IPAddress, _ port: Int32) -> Connection
Function Connect(host As IPAddress, port As Int32) As Connection
Parameters:
- host:
- port:
Connect (String, Int32): Connection virtual (declared in Client)
method Connect(hostname: String; port: Int32): Connection
Connection Connect(String hostname, Int32 port)
func Connect(_ hostname: String, _ port: Int32) -> Connection
Function Connect(hostname As String, port As Int32) As Connection
Parameters:
- hostname:
- port:
Connect (IPAddress, Int32, Binding): Connection virtual (declared in Client)
Overloaded. Use to connect the client to a remote network host using the specified host name (HostName) or IP address (HostAddress) and port number (Port) and/or Binding (BindingV4 or BindingV6).
class method Connect(host: IPAddress; port: Int32; binding: Binding): Connection
static Connection Connect(IPAddress host, Int32 port, Binding binding)
static func Connect(_ host: IPAddress, _ port: Int32, _ binding: Binding) -> Connection
Shared Function Connect(host As IPAddress, port As Int32, binding As Binding) As Connection
Parameters:
- host:
- port:
- binding:
Connect (String, Int32, Binding): Connection virtual (declared in Client)
Overloaded. Use to connect the client to a remote network host using the specified host name (HostName) or IP address (HostAddress) and port number (Port) and/or Binding (BindingV4 or BindingV6).
class method Connect(hostname: String; port: Int32; binding: Binding): Connection
static Connection Connect(String hostname, Int32 port, Binding binding)
static func Connect(_ hostname: String, _ port: Int32, _ binding: Binding) -> Connection
Shared Function Connect(hostname As String, port As Int32, binding As Binding) As Connection
Parameters:
- hostname:
- port:
- binding:
ConnectionClass (declared in Client) .NET, .NET Core 5.0, .NET Standard 2.0
Use the ConnectionClass property to specify an alternative Connection class to be used for out coming data connections. The class described by the assigned Type must be a descendant of Connection, and will be used for all connections that are established after the property has been set. Existing connections are not affected by changing the property.
If ConnectionType is null (default), instances of the Connection base class will be used.
property ConnectionClass: Type read write;
Type ConnectionClass { get; set; }
var ConnectionClass: Type { get{} set{} }
Property ConnectionClass() As Type
ConnectionFactory virtual (declared in Client)
Represents an interface for a connection.
property ConnectionFactory: IConnectionFactory read write;
IConnectionFactory ConnectionFactory { get; set; }
var ConnectionFactory: IConnectionFactory { get{} set{} }
Property ConnectionFactory() As IConnectionFactory
ConnectionPool protected virtual (declared in Client)
property ConnectionPool: ConnectionPool read write;
ConnectionPool ConnectionPool { get; set; }
var ConnectionPool: ConnectionPool { get{} set{} }
Property ConnectionPool() As ConnectionPool
ConnectNew virtual (declared in Client)
method ConnectNew: Connection
Connection ConnectNew()
func ConnectNew() -> Connection
Function ConnectNew() As Connection
ConnectNew (IPAddress, Int32): Connection virtual (declared in Client)
Overloaded. Opens and returns new connection with specified IP address and port.
method ConnectNew(host: IPAddress; port: Int32): Connection
Connection ConnectNew(IPAddress host, Int32 port)
func ConnectNew(_ host: IPAddress, _ port: Int32) -> Connection
Function ConnectNew(host As IPAddress, port As Int32) As Connection
Parameters:
- host:
- port:
ConnectNew (String, Int32): Connection virtual (declared in Client)
method ConnectNew(hostname: String; port: Int32): Connection
Connection ConnectNew(String hostname, Int32 port)
func ConnectNew(_ hostname: String, _ port: Int32) -> Connection
Function ConnectNew(hostname As String, port As Int32) As Connection
Parameters:
- hostname:
- port:
CustomConnectionPool virtual
Gets or sets the custom connection pool. This property is inherited from the Client class.
property CustomConnectionPool: ConnectionPool read write;
ConnectionPool CustomConnectionPool { get; set; }
var CustomConnectionPool: ConnectionPool { get{} set{} }
Property CustomConnectionPool() As ConnectionPool
Dispatch virtual
One of the core methods of the HttpClient class. This method uses the HttpClientRequest class to send messages to the server and the HttpClientResponse to receive server answers.
This method uses the TryDispatch method to send data and raises an HttpException exception if any errors occurs.
method Dispatch(request: HttpClientRequest): HttpClientResponse
HttpClientResponse Dispatch(HttpClientRequest request)
func Dispatch(_ request: HttpClientRequest) -> HttpClientResponse
Function Dispatch(request As HttpClientRequest) As HttpClientResponse
Parameters:
- request:
Dispose protected virtual (declared in Component) Island, Toffee
method Dispose(disposing: Boolean)
void Dispose(Boolean disposing)
func Dispose(_ disposing: Boolean)
Sub Dispose(disposing As Boolean)
Parameters:
- disposing:
DnsResolveType virtual (declared in Client)
Determines if the specified HostName should be look up only Once per application run (if you establish multiple connections to the server, the subsequent connections will use the cached IPAddress) or Always, for each connect (the Hostname will be resolved again for each subsequet connect).
You'll usually only change this setting off the defaut (Once) if you anticipate the IPAddress of the target host to change frequently.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(DnsResolveType.Once)]
property DnsResolveType: DnsResolveType read write;
// Island
property DnsResolveType: DnsResolveType read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(DnsResolveType.Once)]
DnsResolveType DnsResolveType { get; set; }
// Island
DnsResolveType DnsResolveType { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(DnsResolveType.Once)
var DnsResolveType: DnsResolveType { get{} set{} }
// Island, Toffee
var DnsResolveType: DnsResolveType { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(DnsResolveType.Once)>
Property DnsResolveType() As DnsResolveType
// Island
Property DnsResolveType() As DnsResolveType
EnableNagle virtual (declared in Client)
Set its value to true to enable the Nagle algorithm for send coalescing.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(false)]
property EnableNagle: Boolean read write;
// Island
property EnableNagle: Boolean read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(false)]
Boolean EnableNagle { get; set; }
// Island
Boolean EnableNagle { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(false)
var EnableNagle: Boolean { get{} set{} }
// Island, Toffee
var EnableNagle: Boolean { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(false)>
Property EnableNagle() As Boolean
// Island
Property EnableNagle() As Boolean
Retrieves an HTTP document (as a string) from the provided URL using the GET HTTP command.
method Get(url: String): String
String Get(String url)
func Get(_ url: String) -> String
Function Get(url As String) As String
Parameters:
- url:
Retrieves an HTTP document (as a string) in the specified encoding from the provided URL using the GET HTTP command.
method Get(url: String; encoding: Encoding): String
String Get(String url, Encoding encoding)
func Get(_ url: String, _ encoding: Encoding) -> String
Function Get(url As String, encoding As Encoding) As String
Parameters:
- url:
- encoding:
GetBytes virtual
Retrieves binary data from the provided URL.
method GetBytes(url: String): array of Byte
Byte[] GetBytes(String url)
func GetBytes(_ url: String) -> Byte...
Function GetBytes(url As String) As Byte()
Parameters:
- url:
GetConnection protected override
method GetConnection(host: IPAddress; port: Int32): Connection
Connection GetConnection(IPAddress host, Int32 port)
func GetConnection(_ host: IPAddress, _ port: Int32) -> Connection
Function GetConnection(host As IPAddress, port As Int32) As Connection
Parameters:
- host:
- port:
GetResponse virtual
This method is used internally by all other Get* methods of this class. It creates and sends a GET HTTP request to the server and returns a response.
method GetResponse(url: String): HttpClientResponse
HttpClientResponse GetResponse(String url)
func GetResponse(_ url: String) -> HttpClientResponse
Function GetResponse(url As String) As HttpClientResponse
Parameters:
- url:
HostAddress virtual (declared in Client)
Gets or sets an Internet Protocol (IP) address.
property HostAddress: IPAddress read write;
IPAddress HostAddress { get; set; }
var HostAddress: IPAddress { get{} set{} }
Property HostAddress() As IPAddress
HostName virtual (declared in Client)
The server host name or IP address that you intend the client to connect to.
property HostName: String read write;
String HostName { get; set; }
var HostName: String { get{} set{} }
Property HostName() As String
KeepAlive virtual
Controls whether to use HTTP Keep-Alive to keep the connection alive between requests.
If enabled (true), once a request is made and a connection is established, this connection is kept open and used for future requests.
If disabled, the connection is closed, and a new connection is created for future requests.
Since establishing a connection is - relatively speaking - a costly and resource intensive operation for the network, compared to sending small amounts of data, it is recommended to keep this option enabled for optimal performance, if requests to the server are done relatively frequently.
For Keep-Alive to work, the option must be supported and enabled on both client and server.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(true)]
property KeepAlive: Boolean read write;
// Island
property KeepAlive: Boolean read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(true)]
Boolean KeepAlive { get; set; }
// Island
Boolean KeepAlive { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(true)
var KeepAlive: Boolean { get{} set{} }
// Island, Toffee
var KeepAlive: Boolean { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(true)>
Property KeepAlive() As Boolean
// Island
Property KeepAlive() As Boolean
NewConnection protected override
method NewConnection(binding: Binding): Connection
Connection NewConnection(Binding binding)
func NewConnection(_ binding: Binding) -> Connection
Function NewConnection(binding As Binding) As Connection
Parameters:
- binding:
OnResolvedHostName (declared in Client)
This event is fired after the hostname has been successfully resolved.
event OnResolvedHostName: OnResolvedHostNameEventHandler
delegate: method OnResolvedHostName(sender: Object; e: OnResolvedHostNameEventArgs)
delegate OnResolvedHostNameEventHandler OnResolvedHostName()
delegate: void OnResolvedHostName(Object sender, OnResolvedHostNameEventArgs e)
__event OnResolvedHostNameEventHandler: OnResolvedHostName!
delegate: func OnResolvedHostName(_ sender: Object, _ e: OnResolvedHostNameEventArgs)
Event OnResolvedHostName As OnResolvedHostNameEventHandler
delegate: Sub OnResolvedHostName(sender As Object, e As OnResolvedHostNameEventArgs)
OnResolveHostName (declared in Client)
This event is fired before the Client attepts to resolve the sepcifed HostName to an IP address. It provides you with an option to perform the resolution yourself, obtain the IP address from an internal cache you're maintaing, or do some other processing (such as for example chaging the hostname to look up).
event OnResolveHostName: OnResolveHostNameEventHandler
delegate: method OnResolveHostName(sender: Object; e: OnResolveHostNameEventArgs)
delegate OnResolveHostNameEventHandler OnResolveHostName()
delegate: void OnResolveHostName(Object sender, OnResolveHostNameEventArgs e)
__event OnResolveHostNameEventHandler: OnResolveHostName!
delegate: func OnResolveHostName(_ sender: Object, _ e: OnResolveHostNameEventArgs)
Event OnResolveHostName As OnResolveHostNameEventHandler
delegate: Sub OnResolveHostName(sender As Object, e As OnResolveHostNameEventArgs)
Password virtual
Password that will be inserted into the Authorization HTTP header in the request to the server.
property Password: String read write;
String Password { get; set; }
var Password: String { get{} set{} }
Property Password() As String
Port virtual (declared in Client)
The server Port that you intend the client to connect to.
property Port: Int32 read write;
Int32 Port { get; set; }
var Port: Int32 { get{} set{} }
Property Port() As Int32
Retrieves an HTTP document (as a string) from the provided URL using the POST HTTP command.
method Post(url: String; content: array of Byte): String
String Post(String url, Byte[] content)
func Post(_ url: String, _ content: Byte...) -> String
Function Post(url As String, content As Byte()) As String
Parameters:
- url:
- content:
method Post(url: String; content: Stream): String
String Post(String url, Stream content)
func Post(_ url: String, _ content: Stream) -> String
Function Post(url As String, content As Stream) As String
Parameters:
- url:
- content:
ProxySettings virtual
property ProxySettings: HttpProxySettings read;
HttpProxySettings ProxySettings { get; }
var ProxySettings: HttpProxySettings { get{} }
ReadOnly Property ProxySettings() As HttpProxySettings
ReleaseConnection protected virtual (declared in Client)
method ReleaseConnection(connection: Connection)
void ReleaseConnection(Connection connection)
func ReleaseConnection(_ connection: Connection)
Sub ReleaseConnection(connection As Connection)
Parameters:
- connection:
ResolveHostName protected virtual (declared in Client)
method ResolveHostName
void ResolveHostName()
func ResolveHostName()
Sub ResolveHostName()
ResolveHostNameIfNeeded protected virtual (declared in Client)
method ResolveHostNameIfNeeded
void ResolveHostNameIfNeeded()
func ResolveHostNameIfNeeded()
Sub ResolveHostNameIfNeeded()
Timeout virtual
Gets or sets the maximum amount of time (in seconds) that a client will wait for a server response within a single request. The default value is 60 seconds (1 minute).
The timeout handling can be activated via the TimeoutEnabled property.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(60)]
property Timeout: Int32 read write;
// Island
property Timeout: Int32 read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(60)]
Int32 Timeout { get; set; }
// Island
Int32 Timeout { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(60)
var Timeout: Int32 { get{} set{} }
// Island, Toffee
var Timeout: Int32 { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(60)>
Property Timeout() As Int32
// Island
Property Timeout() As Int32
TimeoutEnabled virtual
This property controls whether the request operation will do an automatic timeout checking. If timeout handling is turned on (i.e. this property is set to true) and a request takes longer than Timeout, it will be terminated.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(true)]
property TimeoutEnabled: Boolean read write;
// Island
property TimeoutEnabled: Boolean read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(true)]
Boolean TimeoutEnabled { get; set; }
// Island
Boolean TimeoutEnabled { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(true)
var TimeoutEnabled: Boolean { get{} set{} }
// Island, Toffee
var TimeoutEnabled: Boolean { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(true)>
Property TimeoutEnabled() As Boolean
// Island
Property TimeoutEnabled() As Boolean
TriggerOnResolvedHostName protected virtual (declared in Client)
method TriggerOnResolvedHostName(e: OnResolvedHostNameEventArgs)
void TriggerOnResolvedHostName(OnResolvedHostNameEventArgs e)
func TriggerOnResolvedHostName(_ e: OnResolvedHostNameEventArgs)
Sub TriggerOnResolvedHostName(e As OnResolvedHostNameEventArgs)
Parameters:
- e:
TriggerOnResolveHostName protected virtual (declared in Client)
method TriggerOnResolveHostName(e: OnResolveHostNameEventArgs)
void TriggerOnResolveHostName(OnResolveHostNameEventArgs e)
func TriggerOnResolveHostName(_ e: OnResolveHostNameEventArgs)
Sub TriggerOnResolveHostName(e As OnResolveHostNameEventArgs)
Parameters:
- e:
TryDispatch virtual
The core method of the HttpClient class. This method uses the HttpClientRequest class to send messages to the server and the HttpClientResponse to receive a server answer.
method TryDispatch(request: HttpClientRequest): HttpClientResponse
HttpClientResponse TryDispatch(HttpClientRequest request)
func TryDispatch(_ request: HttpClientRequest) -> HttpClientResponse
Function TryDispatch(request As HttpClientRequest) As HttpClientResponse
Parameters:
- request:
UseConnectionPooling virtual
Enables or disables connection pooling.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(false)]
property UseConnectionPooling: Boolean read write;
// Island
property UseConnectionPooling: Boolean read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(false)]
Boolean UseConnectionPooling { get; set; }
// Island
Boolean UseConnectionPooling { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(false)
var UseConnectionPooling: Boolean { get{} set{} }
// Island, Toffee
var UseConnectionPooling: Boolean { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(false)>
Property UseConnectionPooling() As Boolean
// Island
Property UseConnectionPooling() As Boolean
UserAgent virtual
Gets or sets the identifier of the software being used to retrieve data via the URL. Some custom HTTP servers check this HTTP header to provide content optimized for particular HTTP browsers (like Internet Explorer or Chrome).
The efault value is RemObjects Internet Pack HTTP Client.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue('RemObjects Internet Pack HTTP Client')]
property UserAgent: String read write;
// Island
property UserAgent: String read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(\"RemObjects Internet Pack HTTP Client\")]
String UserAgent { get; set; }
// Island
String UserAgent { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(\"RemObjects Internet Pack HTTP Client\")
var UserAgent: String { get{} set{} }
// Island, Toffee
var UserAgent: String { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(\"RemObjects Internet Pack HTTP Client\")>
Property UserAgent() As String
// Island
Property UserAgent() As String
UserName virtual
Name that will be inserted into the Authorization HTTP header in the request to the server.
property UserName: String read write;
String UserName { get; set; }
var UserName: String { get{} set{} }
Property UserName() As String
Version virtual
Gets or sets the version identifier of the UserAgent. Can be used to mimic particular browsers like Internet Explorer 6.0
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue('1.1')]
property Version: String read write;
// Island
property Version: String read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(\"1.1\")]
String Version { get; set; }
// Island
String Version { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(\"1.1\")
var Version: String { get{} set{} }
// Island, Toffee
var Version: String { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(\"1.1\")>
Property Version() As String
// Island
Property Version() As String
Accept virtual
Gets or sets content types that are acceptable for the response. The default value is "text/html, image/gif, image/jpeg, image/png, /".
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue('text/html, image/gif, image/jpeg, image/png, /')]
property Accept: String read write;
// Island
property Accept: String read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(\"text/html, image/gif, image/jpeg, image/png, /\")]
String Accept { get; set; }
// Island
String Accept { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(\"text/html, image/gif, image/jpeg, image/png, /\")
var Accept: String { get{} set{} }
// Island, Toffee
var Accept: String { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(\"text/html, image/gif, image/jpeg, image/png, /\")>
Property Accept() As String
// Island
Property Accept() As String
Binding virtual (declared in Client)
Obsolete - Please use BindingV4 and BindingV6 instead.
property Binding: Binding read;
Binding Binding { get; }
var Binding: Binding { get{} }
ReadOnly Property Binding() As Binding
BindingV4 virtual (declared in Client)
Gets the binding which provides properties and methods such as address family, IPv4 address, port number etc for client to connect to the host network.
property BindingV4: Binding read;
Binding BindingV4 { get; }
var BindingV4: Binding { get{} }
ReadOnly Property BindingV4() As Binding
BindingV6 virtual (declared in Client)
Gets the binding which provides properties and methods such as address family, IPv6 address, port number etc for client to connect to the host network.
property BindingV6: Binding read;
Binding BindingV6 { get; }
var BindingV6: Binding { get{} }
ReadOnly Property BindingV6() As Binding
ConnectionClass (declared in Client) .NET, .NET Core 5.0, .NET Standard 2.0
Use the ConnectionClass property to specify an alternative Connection class to be used for out coming data connections. The class described by the assigned Type must be a descendant of Connection, and will be used for all connections that are established after the property has been set. Existing connections are not affected by changing the property.
If ConnectionType is null (default), instances of the Connection base class will be used.
property ConnectionClass: Type read write;
Type ConnectionClass { get; set; }
var ConnectionClass: Type { get{} set{} }
Property ConnectionClass() As Type
ConnectionFactory virtual (declared in Client)
Represents an interface for a connection.
property ConnectionFactory: IConnectionFactory read write;
IConnectionFactory ConnectionFactory { get; set; }
var ConnectionFactory: IConnectionFactory { get{} set{} }
Property ConnectionFactory() As IConnectionFactory
ConnectionPool protected virtual (declared in Client)
property ConnectionPool: ConnectionPool read write;
ConnectionPool ConnectionPool { get; set; }
var ConnectionPool: ConnectionPool { get{} set{} }
Property ConnectionPool() As ConnectionPool
CustomConnectionPool virtual
Gets or sets the custom connection pool. This property is inherited from the Client class.
property CustomConnectionPool: ConnectionPool read write;
ConnectionPool CustomConnectionPool { get; set; }
var CustomConnectionPool: ConnectionPool { get{} set{} }
Property CustomConnectionPool() As ConnectionPool
DnsResolveType virtual (declared in Client)
Determines if the specified HostName should be look up only Once per application run (if you establish multiple connections to the server, the subsequent connections will use the cached IPAddress) or Always, for each connect (the Hostname will be resolved again for each subsequet connect).
You'll usually only change this setting off the defaut (Once) if you anticipate the IPAddress of the target host to change frequently.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(DnsResolveType.Once)]
property DnsResolveType: DnsResolveType read write;
// Island
property DnsResolveType: DnsResolveType read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(DnsResolveType.Once)]
DnsResolveType DnsResolveType { get; set; }
// Island
DnsResolveType DnsResolveType { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(DnsResolveType.Once)
var DnsResolveType: DnsResolveType { get{} set{} }
// Island, Toffee
var DnsResolveType: DnsResolveType { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(DnsResolveType.Once)>
Property DnsResolveType() As DnsResolveType
// Island
Property DnsResolveType() As DnsResolveType
EnableNagle virtual (declared in Client)
Set its value to true to enable the Nagle algorithm for send coalescing.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(false)]
property EnableNagle: Boolean read write;
// Island
property EnableNagle: Boolean read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(false)]
Boolean EnableNagle { get; set; }
// Island
Boolean EnableNagle { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(false)
var EnableNagle: Boolean { get{} set{} }
// Island, Toffee
var EnableNagle: Boolean { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(false)>
Property EnableNagle() As Boolean
// Island
Property EnableNagle() As Boolean
HostAddress virtual (declared in Client)
Gets or sets an Internet Protocol (IP) address.
property HostAddress: IPAddress read write;
IPAddress HostAddress { get; set; }
var HostAddress: IPAddress { get{} set{} }
Property HostAddress() As IPAddress
HostName virtual (declared in Client)
The server host name or IP address that you intend the client to connect to.
property HostName: String read write;
String HostName { get; set; }
var HostName: String { get{} set{} }
Property HostName() As String
KeepAlive virtual
Controls whether to use HTTP Keep-Alive to keep the connection alive between requests.
If enabled (true), once a request is made and a connection is established, this connection is kept open and used for future requests.
If disabled, the connection is closed, and a new connection is created for future requests.
Since establishing a connection is - relatively speaking - a costly and resource intensive operation for the network, compared to sending small amounts of data, it is recommended to keep this option enabled for optimal performance, if requests to the server are done relatively frequently.
For Keep-Alive to work, the option must be supported and enabled on both client and server.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(true)]
property KeepAlive: Boolean read write;
// Island
property KeepAlive: Boolean read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(true)]
Boolean KeepAlive { get; set; }
// Island
Boolean KeepAlive { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(true)
var KeepAlive: Boolean { get{} set{} }
// Island, Toffee
var KeepAlive: Boolean { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(true)>
Property KeepAlive() As Boolean
// Island
Property KeepAlive() As Boolean
Password virtual
Password that will be inserted into the Authorization HTTP header in the request to the server.
property Password: String read write;
String Password { get; set; }
var Password: String { get{} set{} }
Property Password() As String
Port virtual (declared in Client)
The server Port that you intend the client to connect to.
property Port: Int32 read write;
Int32 Port { get; set; }
var Port: Int32 { get{} set{} }
Property Port() As Int32
ProxySettings virtual
property ProxySettings: HttpProxySettings read;
HttpProxySettings ProxySettings { get; }
var ProxySettings: HttpProxySettings { get{} }
ReadOnly Property ProxySettings() As HttpProxySettings
Timeout virtual
Gets or sets the maximum amount of time (in seconds) that a client will wait for a server response within a single request. The default value is 60 seconds (1 minute).
The timeout handling can be activated via the TimeoutEnabled property.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(60)]
property Timeout: Int32 read write;
// Island
property Timeout: Int32 read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(60)]
Int32 Timeout { get; set; }
// Island
Int32 Timeout { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(60)
var Timeout: Int32 { get{} set{} }
// Island, Toffee
var Timeout: Int32 { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(60)>
Property Timeout() As Int32
// Island
Property Timeout() As Int32
TimeoutEnabled virtual
This property controls whether the request operation will do an automatic timeout checking. If timeout handling is turned on (i.e. this property is set to true) and a request takes longer than Timeout, it will be terminated.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(true)]
property TimeoutEnabled: Boolean read write;
// Island
property TimeoutEnabled: Boolean read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(true)]
Boolean TimeoutEnabled { get; set; }
// Island
Boolean TimeoutEnabled { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(true)
var TimeoutEnabled: Boolean { get{} set{} }
// Island, Toffee
var TimeoutEnabled: Boolean { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(true)>
Property TimeoutEnabled() As Boolean
// Island
Property TimeoutEnabled() As Boolean
UseConnectionPooling virtual
Enables or disables connection pooling.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(false)]
property UseConnectionPooling: Boolean read write;
// Island
property UseConnectionPooling: Boolean read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(false)]
Boolean UseConnectionPooling { get; set; }
// Island
Boolean UseConnectionPooling { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(false)
var UseConnectionPooling: Boolean { get{} set{} }
// Island, Toffee
var UseConnectionPooling: Boolean { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(false)>
Property UseConnectionPooling() As Boolean
// Island
Property UseConnectionPooling() As Boolean
UserAgent virtual
Gets or sets the identifier of the software being used to retrieve data via the URL. Some custom HTTP servers check this HTTP header to provide content optimized for particular HTTP browsers (like Internet Explorer or Chrome).
The efault value is RemObjects Internet Pack HTTP Client.
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue('RemObjects Internet Pack HTTP Client')]
property UserAgent: String read write;
// Island
property UserAgent: String read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(\"RemObjects Internet Pack HTTP Client\")]
String UserAgent { get; set; }
// Island
String UserAgent { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(\"RemObjects Internet Pack HTTP Client\")
var UserAgent: String { get{} set{} }
// Island, Toffee
var UserAgent: String { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(\"RemObjects Internet Pack HTTP Client\")>
Property UserAgent() As String
// Island
Property UserAgent() As String
UserName virtual
Name that will be inserted into the Authorization HTTP header in the request to the server.
property UserName: String read write;
String UserName { get; set; }
var UserName: String { get{} set{} }
Property UserName() As String
Version virtual
Gets or sets the version identifier of the UserAgent. Can be used to mimic particular browsers like Internet Explorer 6.0
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue('1.1')]
property Version: String read write;
// Island
property Version: String read write;
// .NET, .NET Core 5.0, .NET Standard 2.0
[DefaultValue(\"1.1\")]
String Version { get; set; }
// Island
String Version { get; set; }
// .NET, .NET Core 5.0, .NET Standard 2.0
@DefaultValue(\"1.1\")
var Version: String { get{} set{} }
// Island, Toffee
var Version: String { get{} set{} }
// .NET, .NET Core 5.0, .NET Standard 2.0
<DefaultValue(\"1.1\")>
Property Version() As String
// Island
Property Version() As String
Connect (IPAddress, Int32, Binding): Connection virtual (declared in Client)
Overloaded. Use to connect the client to a remote network host using the specified host name (HostName) or IP address (HostAddress) and port number (Port) and/or Binding (BindingV4 or BindingV6).
class method Connect(host: IPAddress; port: Int32; binding: Binding): Connection
static Connection Connect(IPAddress host, Int32 port, Binding binding)
static func Connect(_ host: IPAddress, _ port: Int32, _ binding: Binding) -> Connection
Shared Function Connect(host As IPAddress, port As Int32, binding As Binding) As Connection
Parameters:
- host:
- port:
- binding:
Connect (String, Int32, Binding): Connection virtual (declared in Client)
Overloaded. Use to connect the client to a remote network host using the specified host name (HostName) or IP address (HostAddress) and port number (Port) and/or Binding (BindingV4 or BindingV6).
class method Connect(hostname: String; port: Int32; binding: Binding): Connection
static Connection Connect(String hostname, Int32 port, Binding binding)
static func Connect(_ hostname: String, _ port: Int32, _ binding: Binding) -> Connection
Shared Function Connect(hostname As String, port As Int32, binding As Binding) As Connection
Parameters:
- hostname:
- port:
- binding:
constructor
Creates a new instanse of the HttpClient class.
constructor
HttpClient()
init()
Sub New()
Abort virtual
Closes the currently open connection (if present).
method Abort
void Abort()
func Abort()
Sub Abort()
Connect virtual (declared in Client)
method Connect: Connection
Connection Connect()
func Connect() -> Connection
Function Connect() As Connection
Connect (IPAddress, Int32): Connection virtual (declared in Client)
method Connect(host: IPAddress; port: Int32): Connection
Connection Connect(IPAddress host, Int32 port)
func Connect(_ host: IPAddress, _ port: Int32) -> Connection
Function Connect(host As IPAddress, port As Int32) As Connection
Parameters:
- host:
- port:
Connect (String, Int32): Connection virtual (declared in Client)
method Connect(hostname: String; port: Int32): Connection
Connection Connect(String hostname, Int32 port)
func Connect(_ hostname: String, _ port: Int32) -> Connection
Function Connect(hostname As String, port As Int32) As Connection
Parameters:
- hostname:
- port:
ConnectNew virtual (declared in Client)
method ConnectNew: Connection
Connection ConnectNew()
func ConnectNew() -> Connection
Function ConnectNew() As Connection
ConnectNew (IPAddress, Int32): Connection virtual (declared in Client)
Overloaded. Opens and returns new connection with specified IP address and port.
method ConnectNew(host: IPAddress; port: Int32): Connection
Connection ConnectNew(IPAddress host, Int32 port)
func ConnectNew(_ host: IPAddress, _ port: Int32) -> Connection
Function ConnectNew(host As IPAddress, port As Int32) As Connection
Parameters:
- host:
- port:
ConnectNew (String, Int32): Connection virtual (declared in Client)
method ConnectNew(hostname: String; port: Int32): Connection
Connection ConnectNew(String hostname, Int32 port)
func ConnectNew(_ hostname: String, _ port: Int32) -> Connection
Function ConnectNew(hostname As String, port As Int32) As Connection
Parameters:
- hostname:
- port:
Dispatch virtual
One of the core methods of the HttpClient class. This method uses the HttpClientRequest class to send messages to the server and the HttpClientResponse to receive server answers.
This method uses the TryDispatch method to send data and raises an HttpException exception if any errors occurs.
method Dispatch(request: HttpClientRequest): HttpClientResponse
HttpClientResponse Dispatch(HttpClientRequest request)
func Dispatch(_ request: HttpClientRequest) -> HttpClientResponse
Function Dispatch(request As HttpClientRequest) As HttpClientResponse
Parameters:
- request:
Dispose protected virtual (declared in Component) Island, Toffee
method Dispose(disposing: Boolean)
void Dispose(Boolean disposing)
func Dispose(_ disposing: Boolean)
Sub Dispose(disposing As Boolean)
Parameters:
- disposing:
Retrieves an HTTP document (as a string) from the provided URL using the GET HTTP command.
method Get(url: String): String
String Get(String url)
func Get(_ url: String) -> String
Function Get(url As String) As String
Parameters:
- url:
Retrieves an HTTP document (as a string) in the specified encoding from the provided URL using the GET HTTP command.
method Get(url: String; encoding: Encoding): String
String Get(String url, Encoding encoding)
func Get(_ url: String, _ encoding: Encoding) -> String
Function Get(url As String, encoding As Encoding) As String
Parameters:
- url:
- encoding:
GetBytes virtual
Retrieves binary data from the provided URL.
method GetBytes(url: String): array of Byte
Byte[] GetBytes(String url)
func GetBytes(_ url: String) -> Byte...
Function GetBytes(url As String) As Byte()
Parameters:
- url:
GetConnection protected override
method GetConnection(host: IPAddress; port: Int32): Connection
Connection GetConnection(IPAddress host, Int32 port)
func GetConnection(_ host: IPAddress, _ port: Int32) -> Connection
Function GetConnection(host As IPAddress, port As Int32) As Connection
Parameters:
- host:
- port:
GetResponse virtual
This method is used internally by all other Get* methods of this class. It creates and sends a GET HTTP request to the server and returns a response.
method GetResponse(url: String): HttpClientResponse
HttpClientResponse GetResponse(String url)
func GetResponse(_ url: String) -> HttpClientResponse
Function GetResponse(url As String) As HttpClientResponse
Parameters:
- url:
NewConnection protected override
method NewConnection(binding: Binding): Connection
Connection NewConnection(Binding binding)
func NewConnection(_ binding: Binding) -> Connection
Function NewConnection(binding As Binding) As Connection
Parameters:
- binding:
Retrieves an HTTP document (as a string) from the provided URL using the POST HTTP command.
method Post(url: String; content: array of Byte): String
String Post(String url, Byte[] content)
func Post(_ url: String, _ content: Byte...) -> String
Function Post(url As String, content As Byte()) As String
Parameters:
- url:
- content:
method Post(url: String; content: Stream): String
String Post(String url, Stream content)
func Post(_ url: String, _ content: Stream) -> String
Function Post(url As String, content As Stream) As String
Parameters:
- url:
- content:
ReleaseConnection protected virtual (declared in Client)
method ReleaseConnection(connection: Connection)
void ReleaseConnection(Connection connection)
func ReleaseConnection(_ connection: Connection)
Sub ReleaseConnection(connection As Connection)
Parameters:
- connection:
ResolveHostName protected virtual (declared in Client)
method ResolveHostName
void ResolveHostName()
func ResolveHostName()
Sub ResolveHostName()
ResolveHostNameIfNeeded protected virtual (declared in Client)
method ResolveHostNameIfNeeded
void ResolveHostNameIfNeeded()
func ResolveHostNameIfNeeded()
Sub ResolveHostNameIfNeeded()
TriggerOnResolvedHostName protected virtual (declared in Client)
method TriggerOnResolvedHostName(e: OnResolvedHostNameEventArgs)
void TriggerOnResolvedHostName(OnResolvedHostNameEventArgs e)
func TriggerOnResolvedHostName(_ e: OnResolvedHostNameEventArgs)
Sub TriggerOnResolvedHostName(e As OnResolvedHostNameEventArgs)
Parameters:
- e:
TriggerOnResolveHostName protected virtual (declared in Client)
method TriggerOnResolveHostName(e: OnResolveHostNameEventArgs)
void TriggerOnResolveHostName(OnResolveHostNameEventArgs e)
func TriggerOnResolveHostName(_ e: OnResolveHostNameEventArgs)
Sub TriggerOnResolveHostName(e As OnResolveHostNameEventArgs)
Parameters:
- e:
TryDispatch virtual
The core method of the HttpClient class. This method uses the HttpClientRequest class to send messages to the server and the HttpClientResponse to receive a server answer.
method TryDispatch(request: HttpClientRequest): HttpClientResponse
HttpClientResponse TryDispatch(HttpClientRequest request)
func TryDispatch(_ request: HttpClientRequest) -> HttpClientResponse
Function TryDispatch(request As HttpClientRequest) As HttpClientResponse
Parameters:
- request:
OnResolvedHostName (declared in Client)
This event is fired after the hostname has been successfully resolved.
event OnResolvedHostName: OnResolvedHostNameEventHandler
delegate: method OnResolvedHostName(sender: Object; e: OnResolvedHostNameEventArgs)
delegate OnResolvedHostNameEventHandler OnResolvedHostName()
delegate: void OnResolvedHostName(Object sender, OnResolvedHostNameEventArgs e)
__event OnResolvedHostNameEventHandler: OnResolvedHostName!
delegate: func OnResolvedHostName(_ sender: Object, _ e: OnResolvedHostNameEventArgs)
Event OnResolvedHostName As OnResolvedHostNameEventHandler
delegate: Sub OnResolvedHostName(sender As Object, e As OnResolvedHostNameEventArgs)
OnResolveHostName (declared in Client)
This event is fired before the Client attepts to resolve the sepcifed HostName to an IP address. It provides you with an option to perform the resolution yourself, obtain the IP address from an internal cache you're maintaing, or do some other processing (such as for example chaging the hostname to look up).
event OnResolveHostName: OnResolveHostNameEventHandler
delegate: method OnResolveHostName(sender: Object; e: OnResolveHostNameEventArgs)
delegate OnResolveHostNameEventHandler OnResolveHostName()
delegate: void OnResolveHostName(Object sender, OnResolveHostNameEventArgs e)
__event OnResolveHostNameEventHandler: OnResolveHostName!
delegate: func OnResolveHostName(_ sender: Object, _ e: OnResolveHostNameEventArgs)
Event OnResolveHostName As OnResolveHostNameEventHandler
delegate: Sub OnResolveHostName(sender As Object, e As OnResolveHostNameEventArgs)
- Channel
- Client
- IpHttpClientChannel
- HttpClientRequest
- HttpClientResponse
- Writing HTTP Applications using Internet Pack