Xeno-rat
Loading...
Searching...
No Matches
xeno_rat_server._listener Class Reference
Collaboration diagram for xeno_rat_server._listener:

Public Member Functions

 _listener (int _port)
 
async Task StartListening (Func< Socket, Task > connectCallBack)
 Starts listening for incoming connections and invokes the specified callback function when a connection is established.
 
void StopListening ()
 Stops the listening process and releases the resources associated with the listener.
 

Public Attributes

bool listening =false
 

Private Attributes

Socket listener
 
int port
 

Constructor & Destructor Documentation

◆ _listener()

xeno_rat_server._listener._listener ( int _port)
inline

Member Function Documentation

◆ StartListening()

async Task xeno_rat_server._listener.StartListening ( Func< Socket, Task > connectCallBack)
inline

Starts listening for incoming connections and invokes the specified callback function when a connection is established.

Parameters
connectCallBackThe callback function to be invoked when a connection is established.
Exceptions
ObjectDisposedExceptionThrown when the socket has been closed and the operation is not allowed.

This method starts listening for incoming connections on any available network interface and port specified by the port variable. When a connection is established, the specified connectCallBack function is invoked with the connected socket as a parameter. The method continues to listen for incoming connections until an ObjectDisposedException is thrown, indicating that the socket has been closed.

◆ StopListening()

void xeno_rat_server._listener.StopListening ( )
inline

Stops the listening process and releases the resources associated with the listener.

This method sets the listening flag to false, indicating that the listening process should stop. It then attempts to gracefully shut down the socket for both sending and receiving data using the SocketShutdown.Both option. If an exception occurs during the shutdown process, it is caught and ignored. The method then attempts to close and dispose of the listener, regardless of whether an exception occurred during the shutdown process.

Member Data Documentation

◆ listener

Socket xeno_rat_server._listener.listener
private

◆ listening

bool xeno_rat_server._listener.listening =false

◆ port

int xeno_rat_server._listener.port
private

The documentation for this class was generated from the following file: