Add bindSocket interface

Signed-off-by: fuchao <chao.fu@thundersoft.com>
This commit is contained in:
fuchao 2022-09-28 17:49:43 +08:00
parent 707fb9d355
commit c99f91b887

View File

@ -174,6 +174,17 @@ declare namespace connection {
export interface NetHandle { export interface NetHandle {
netId: number; netId: number;
/**
* Binds a TCPSocket or UDPSocket to the current network. All data flows from
* the socket will use this network, without being subject to {@link setAppNet}.
* Before using this method, ensure that the socket is disconnected.
*
* @param socketParam Indicates the TCPSocket or UDPSocket object.
* @since 9
*/
bindSocket(socketParam: TCPSocket | UDPSocket, callback: AsyncCallback<void>): void;
bindSocket(socketParam: TCPSocket | UDPSocket): Promise<void>;
/** /**
* Resolves a host name to obtain all IP addresses based on the specified NetHandle. * Resolves a host name to obtain all IP addresses based on the specified NetHandle.
* *
@ -275,4 +286,4 @@ declare namespace connection {
} }
} }
export default connection; export default connection;