Definition at line 32 of file Listener.cs.
Ntp.Analyzer.Monitor.Server.Listener.Listener |
( |
string |
ip, |
|
|
int |
port, |
|
|
LogBase |
log |
|
) |
| |
|
inline |
Initializes a new instance of the Listener class.
- Parameters
-
ip | IP Address to listen on. |
port | Port number. |
log | Log. |
Definition at line 40 of file Listener.cs.
42 IPAddress address = IPAddress.Parse(ip);
43 endPoint =
new IPEndPoint(address, port);
readonly IPEndPoint endPoint
Ntp.Analyzer.Monitor.Server.Listener.~Listener |
( |
| ) |
|
|
inlineprivate |
void Ntp.Analyzer.Monitor.Server.Listener.AcceptCallback |
( |
IAsyncResult |
asyncAccept | ) |
|
|
inlineprivate |
Accepts the callback from client.
- Parameters
-
Definition at line 96 of file Listener.cs.
100 Socket serverSocket =
listenSocket.EndAccept(asyncAccept);
102 if (serverSocket.Connected ==
false)
105 var req =
new Request(128, serverSocket);
107 serverSocket.BeginReceive(
abstract void WriteLine(string text, Severity severity)
void ReceiveCallback(IAsyncResult asyncReceive)
Receives the callback from client.
override string ToString()
void Ntp.Analyzer.Monitor.Server.Listener.Close |
( |
| ) |
|
|
inline |
void Ntp.Analyzer.Monitor.Server.Listener.Dispose |
( |
bool |
disposing | ) |
|
|
inlineprivate |
void Ntp.Analyzer.Monitor.Server.Listener.Dispose |
( |
| ) |
|
|
inline |
Definition at line 234 of file Listener.cs.
237 GC.SuppressFinalize(
this);
void Ntp.Analyzer.Monitor.Server.Listener.Open |
( |
| ) |
|
|
inline |
Open this listener.
Definition at line 65 of file Listener.cs.
70 AddressFamily.InterNetwork,
abstract void WriteLine(string text, Severity severity)
readonly IPEndPoint endPoint
override string ToString()
void AcceptCallback(IAsyncResult asyncAccept)
Accepts the callback from client.
void Ntp.Analyzer.Monitor.Server.Listener.ReceiveCallback |
( |
IAsyncResult |
asyncReceive | ) |
|
|
inlineprivate |
Receives the callback from client.
- Parameters
-
asyncReceive | Async receive. |
Definition at line 130 of file Listener.cs.
References Ntp.Analyzer.Monitor.Server.Command.CommandType, Ntp.Analyzer.Monitor.Server.CommandFactory.Create(), and Ntp.Analyzer.Monitor.Server.Command.Execute().
134 var req = (Request) asyncReceive.AsyncState;
135 int size = req.Socket.EndReceive(asyncReceive);
139 Command command = CommandFactory.Create(req.Command, req.Arguments);
142 Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
148 sendBuffer = Encoding.UTF8.GetBytes(
"Unknown command");
151 switch (command.CommandType)
154 sendBuffer = (byte[]) command.Execute();
157 var text = command.Execute() as string;
158 sendBuffer = text != null ? Encoding.UTF8.GetBytes(text) :
new byte[] {0};
161 sendBuffer = Encoding.UTF8.GetBytes(
"Error in command module. Unknown command type.");
165 req.Socket.BeginSend(
abstract void WriteLine(string text, Severity severity)
void SendCallback(IAsyncResult asyncSend)
Sends the callback response to client.
override string ToString()
void Ntp.Analyzer.Monitor.Server.Listener.SendCallback |
( |
IAsyncResult |
asyncSend | ) |
|
|
inlineprivate |
Sends the callback response to client.
- Parameters
-
Definition at line 185 of file Listener.cs.
189 var serverSocket = (Socket) asyncSend.AsyncState;
190 serverSocket.EndSend(asyncSend);
191 serverSocket.Shutdown(SocketShutdown.Both);
192 serverSocket.Close();
abstract void WriteLine(string text, Severity severity)
override string ToString()
void AcceptCallback(IAsyncResult asyncAccept)
Accepts the callback from client.
override string Ntp.Analyzer.Monitor.Server.Listener.ToString |
( |
| ) |
|
|
inline |
Definition at line 87 of file Listener.cs.
readonly IPEndPoint endPoint
bool Ntp.Analyzer.Monitor.Server.Listener.disposedValue |
|
private |
readonly IPEndPoint Ntp.Analyzer.Monitor.Server.Listener.endPoint |
|
private |
Socket Ntp.Analyzer.Monitor.Server.Listener.listenSocket |
|
private |
readonly LogBase Ntp.Analyzer.Monitor.Server.Listener.log |
|
private |
bool Ntp.Analyzer.Monitor.Server.Listener.shuttingDown |
|
private |
The documentation for this class was generated from the following file: