CURL.GetActiveSocket
--------------------

Receive the active socket used by this curl session.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [8.2](newinversion82.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.GetActiveSocket"; curl ) 

**MBS**( **"CURL.GetActiveSocket";** /\* Receive the active socket used by this curl session. \*/  
**$curl**) /\* The CURL session handle. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |

### Result

Returns number or error.

### Description

Receive the active socket used by this curl session.   
If the socket is no longer valid, -1 is returned. When you finish working with the socket, the [CURL.Release](CURLRelease.md) closes the socket and cleanup other resources associated with the handle. This is typically used in combination with [CURL.SetOptionConnectOnly](CURLSetOptionConnectOnly.md).  
This option was added as a replacement for [CURL.GetLastSocket](CURLGetLastSocket.md) since that one isn't working on all platforms.  
  
### See also

- [CURL.GetLastSocket](CURLGetLastSocket.md)
- [CURL.Release](CURLRelease.md)
- [CURL.SetOptionConnectOnly](CURLSetOptionConnectOnly.md)

This function checks for a license.

Created 15th April 2018 , last changed 21st December 2022

  
[CURL.FormFinish](CURLFormFinish.md) - [CURL.GetAppConnectTime](CURLGetAppConnectTime.md)

[HTML Version](CURLGetActiveSocket.shtml)