diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs new file mode 100644 index 0000000..4b39b92 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | |||
@@ -0,0 +1,47 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Net; | ||
4 | using System.Net.Sockets; | ||
5 | using System.Text; | ||
6 | using System.Threading; | ||
7 | |||
8 | namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | ||
9 | { | ||
10 | /// <summary> | ||
11 | /// Adam's completely hacked up not-probably-compliant RFC1459 server class. | ||
12 | /// </summary> | ||
13 | class IRCServer | ||
14 | { | ||
15 | private TcpListener m_listener; | ||
16 | private bool m_running = true; | ||
17 | |||
18 | public IRCServer(IPAddress listener, int port) | ||
19 | { | ||
20 | m_listener = new TcpListener(listener, port); | ||
21 | |||
22 | m_listener.Start(50); | ||
23 | |||
24 | Thread thread = new Thread(ListenLoop); | ||
25 | thread.Start(); | ||
26 | } | ||
27 | |||
28 | public void Stop() | ||
29 | { | ||
30 | m_running = false; | ||
31 | m_listener.Stop(); | ||
32 | } | ||
33 | |||
34 | private void ListenLoop() | ||
35 | { | ||
36 | while(m_running) | ||
37 | { | ||
38 | AcceptClient(m_listener.AcceptTcpClient()); | ||
39 | } | ||
40 | } | ||
41 | |||
42 | private void AcceptClient(TcpClient client) | ||
43 | { | ||
44 | |||
45 | } | ||
46 | } | ||
47 | } | ||