ProtocolServerOpenAsyncT(Boolean, ProtocolAddress, NotifyDataChangedEventHandler, CallbackContext, Object) Method |
Creates a server and starts accepting connections, calling dataChangedHandler with data from each connection as it arrives.
This method returns after the server has been established, leaving the accepting and servicing of connections to a background thread.
Namespace: Demo3D.NetAssembly: Demo3D.IO (in Demo3D.IO.dll) Version: 19.01.00
Syntaxpublic static Task<ServerSocket> OpenAsync<T>(
bool sync,
ProtocolAddress address,
NotifyDataChangedEventHandler dataChangedHandler,
CallbackContext callbackContext = CallbackContext.CallerContext,
Object? userState = null
)
where T : class, INotifyDataChanged
Parameters
- sync Boolean
- If true, the Task returned is guaranteed to be complete.
- address ProtocolAddress
- Address of server.
- dataChangedHandler NotifyDataChangedEventHandler
- Data received handler.
- callbackContext CallbackContext (Optional)
- Defines the context in which the callback should be called.
- userState Object (Optional)
- User state.
Type Parameters
- T
- Required services.
Return Value
TaskServerSocketThe server socket.
Remarks
If callbackContext is CallerContext then dataChangedHandler is Demo3D thread safe.
It's called in the same thread (synchronization context) as the caller to this method.
See Also