Socket.IsListening
------------------

Checks whether socket is listening.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Socket](component_Socket.md) | [9.0](newinversion90.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Socket.IsListening"; SocketID ) 

**MBS**( **"Socket.IsListening";** /\* Checks whether socket is listening. \*/  
**$SocketID**) /\* The socket ID received by [Socket.Connect](SocketConnect.md) function.e.g. $sock \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| SocketID | The socket ID received by [Socket.Connect](SocketConnect.md) function. | $sock |

### Result

Returns 1, 0 or error.

### Description

Checks whether socket is listening.  
Returns 1 if listening, e.g. [Socket.Listen](SocketListen.md) was called.  
### Examples

Check listening state:

 If \[ MBS ( "Socket.IsListening"; $socket ) \]   
 Show Custom Dialog \[ "The socket is listening" \]   
End If  
### See also

- [Socket.Connect](SocketConnect.md)
- [Socket.List](SocketList.md)
- [Socket.Listen](SocketListen.md)

### Release notes

- **Version 9.0**
    - Added [Socket.IsClosed](http://www.mbsplugins.eu/SocketIsClosed.shtml) and [Socket.IsListening](http://www.mbsplugins.eu/SocketIsListening.shtml) functions.

### Blog Entries

- [MBS FileMaker Plugin, version 8.6pr1](https://www.mbsplugins.de/archive/2018-12-01/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 29th November 2018 , last changed 27th August 2023

  
[Socket.IsClosed](SocketIsClosed.md) - [Socket.LastError](SocketLastError.md)

[HTML Version](SocketIsListening.shtml)