Internet Controls
The Internet tab provides 9 controls for web browsing, HTTP/FTP networking, email, WebSocket communication, and TCP/UDP socket programming. All controls are cross-platform and use non-blocking I/O internally.
TWebView CT_WEBVIEW = 62
Embeds a full web browser inside a form. Renders HTML content or navigates to URLs using the platform's native web engine.
| Property | Type | Default | Description |
cURL | String | "" | URL to navigate to |
cHTML | String | "" | Raw HTML content to render |
lCanGoBack | Logical | .F. | Whether navigation history allows going back (read-only) |
lCanGoForward | Logical | .F. | Whether navigation history allows going forward (read-only) |
cTitle | String | "" | Page title (read-only) |
| Event | Category | Description |
OnNavigate | Navigation | Fired before navigating to a new URL. Return .F. to cancel |
OnLoad | Navigation | Page finished loading |
OnError | Error | Navigation or rendering error occurred |
| Platform | Native Widget |
| Windows | WebView2 (Chromium-based Edge) |
| macOS | WKWebView (WebKit) |
| Linux | WebKitGTK (WebKit2) |
TWebServer CT_WEBSERVER = 71
Embedded HTTP/HTTPS server. Allows your application to serve web pages, REST APIs, or act as a local service endpoint.
| Property | Type | Default | Description |
nPort | Numeric | 8080 | Listening port number |
cHost | String | "0.0.0.0" | Bind address |
cDocumentRoot | String | "" | Root directory for static files |
lSSL | Logical | .F. | Enable HTTPS |
cCertFile | String | "" | Path to SSL certificate file |
cKeyFile | String | "" | Path to SSL private key file |
nMaxConnections | Numeric | 256 | Maximum simultaneous connections |
| Event | Category | Description |
OnRequest | Action | HTTP request received. Params: oRequest, oResponse |
OnConnect | Connection | New client connected |
OnDisconnect | Connection | Client disconnected |
OnStart | Lifecycle | Server started listening |
OnStop | Lifecycle | Server stopped |
OnError | Error | Server error occurred |
TWebSocket CT_WEBSOCKET = 72
WebSocket client for real-time bidirectional communication with a server.
| Property | Type | Default | Description |
cURL | String | "" | WebSocket server URL (ws:// or wss://) |
cProtocol | String | "" | Sub-protocol to negotiate |
lAutoReconnect | Logical | .F. | Automatically reconnect on disconnection |
nReconnectDelay | Numeric | 3000 | Delay in ms before reconnect attempt |
| Event | Category | Description |
OnOpen | Connection | Connection established |
OnMessage | Data | Message received from server |
OnClose | Connection | Connection closed |
OnError | Error | Connection or protocol error |
THttpClient CT_HTTPCLIENT = 73
HTTP client for making REST API calls, downloading files, and general HTTP communication.
| Property | Type | Default | Description |
cURL | String | "" | Request URL |
cMethod | String | "GET" | HTTP method (GET, POST, PUT, DELETE, PATCH) |
aHeaders | Array | {} | Request headers as key-value pairs |
cBody | String | "" | Request body content |
nTimeout | Numeric | 30000 | Request timeout in milliseconds |
nStatusCode | Numeric | 0 | Response status code (read-only) |
| Event | Category | Description |
OnResponse | Data | Response received. Params: nStatus, cBody, aHeaders |
OnProgress | Data | Download/upload progress. Params: nCurrent, nTotal |
OnError | Error | Request failed |
TFtpClient CT_FTPCLIENT = 74
FTP/FTPS client for file transfer operations.
| Property | Type | Default | Description |
cHost | String | "" | FTP server hostname |
nPort | Numeric | 21 | Server port |
cUser | String | "" | Login username |
cPassword | String | "" | Login password |
lPassiveMode | Logical | .T. | Use passive mode for data transfers |
lSSL | Logical | .F. | Use FTPS (FTP over TLS) |
| Event | Category | Description |
OnConnect | Connection | Successfully connected to server |
OnTransfer | Data | File transfer progress. Params: cFile, nBytes, nTotal |
OnError | Error | Connection or transfer error |
TSmtpClient CT_SMTPCLIENT = 75
SMTP client for sending email messages with attachments.
| Property | Type | Default | Description |
cHost | String | "" | SMTP server hostname |
nPort | Numeric | 587 | Server port (25, 465, or 587) |
lSSL | Logical | .T. | Use TLS/SSL encryption |
cUser | String | "" | Authentication username |
cPassword | String | "" | Authentication password |
cFrom | String | "" | Sender email address |
cTo | String | "" | Recipient email address(es), comma-separated |
cSubject | String | "" | Email subject line |
cBody | String | "" | Email body content |
| Event | Category | Description |
OnSend | Action | Email sent successfully |
OnError | Error | Send or connection error |
TTcpServer CT_TCPSERVER = 76
TCP socket server. Listens for incoming connections and manages multiple clients.
| Property | Type | Default | Description |
nPort | Numeric | 0 | Listening port |
cHost | String | "0.0.0.0" | Bind address |
nMaxConnections | Numeric | 128 | Maximum simultaneous connections |
lActive | Logical | .F. | Server is currently listening (read-only) |
| Event | Category | Description |
OnAccept | Connection | New client connection accepted. Params: oClient |
OnReceive | Data | Data received from client. Params: oClient, cData |
OnDisconnect | Connection | Client disconnected. Params: oClient |
TTcpClient CT_TCPCLIENT = 77
TCP socket client. Connects to a remote server for stream-based communication.
| Property | Type | Default | Description |
cHost | String | "" | Remote server hostname or IP |
nPort | Numeric | 0 | Remote server port |
nTimeout | Numeric | 10000 | Connection timeout in milliseconds |
lConnected | Logical | .F. | Connection status (read-only) |
| Event | Category | Description |
OnConnect | Connection | Successfully connected to server |
OnReceive | Data | Data received from server. Params: cData |
OnDisconnect | Connection | Disconnected from server |
TUdpSocket CT_UDPSOCKET = 78
UDP datagram socket for connectionless, low-latency communication.
| Property | Type | Default | Description |
nPort | Numeric | 0 | Local port to bind to |
lBroadcast | Logical | .F. | Enable broadcast mode |
cHost | String | "0.0.0.0" | Bind address |
| Event | Category | Description |
OnReceive | Data | Datagram received. Params: cData, cSenderIP, nSenderPort |
Code Example: Simple Web Server
// A simple web server that responds to HTTP requests
FUNCTION Main()
LOCAL oServer
oServer := TWebServer():New()
oServer:nPort := 8080
oServer:cDocumentRoot := "./public"
oServer:OnRequest := { |oReq, oRes| HandleRequest( oReq, oRes ) }
oServer:OnStart := { || QOut( "Server running on port 8080" ) }
oServer:OnError := { |e| QOut( "Error: " + e:Description ) }
oServer:Start()
// Keep the application running
WAIT "Press any key to stop..."
oServer:Stop()
RETURN NIL
FUNCTION HandleRequest( oReq, oRes )
DO CASE
CASE oReq:cPath == "/api/hello"
oRes:cContentType := "application/json"
oRes:cBody := '{"message": "Hello from HarbourBuilder!"}'
CASE oReq:cPath == "/api/time"
oRes:cContentType := "application/json"
oRes:cBody := '{"time": "' + Time() + '"}'
OTHERWISE
oRes:nStatus := 404
oRes:cBody := "Not Found"
ENDCASE
RETURN NIL
9 Internet Controls
All Internet controls use asynchronous, event-driven I/O. Network operations never block the UI thread.
TLS/SSL is supported on all platforms using the system's native certificate store.