Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3   13.4   13.5    Statistic    FMM    Blog  

Socket.AcceptNewConnection

Accepts a new connection and returns a new socket.

Component Version macOS Windows Linux Server iOS SDK
Socket 3.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Socket.AcceptNewConnection"; SocketID )   More

Parameters

Parameter Description Example
SocketID The socket ID received by Socket.Connect function. $sock

Result

Returns new Socket ID or error message.

Description

Accepts a new connection and returns a new socket.

Examples

In the script triggered for a new connection, connect a new socket:

Set Variable [$sock; Value:Get(ScriptParameter)]
Set Variable [$newSock; Value:MBS("Socket.AcceptNewConnection"; $sock)]
If [GetAsNumber($newSock)>0]
    Set Variable [$r; Value:MBS("Socket.SetErrorHandler"; $newsock; Get(FileName); "SocketError")]
    Set Variable [$r; Value:MBS("Socket.SetDataAvailableHandler"; $newsock; Get(FileName); "ReadSomething")]
End If

See also

Example Databases

This function checks for a license.

Created 18th August 2014, last changed 26th January 2016


SocialRequest.addMultipartText - Socket.AddMembership

💬 Ask a question or report a problem