Mercurial > hg > Database > Christie-sharp
view daemon/OutboundTcpConnection.cs @ 23:46cfeb0609c5
Add TcpConnections
author | riono <e165729@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Dec 2020 22:11:40 +0900 |
parents | |
children | 1236da135f79 |
line wrap: on
line source
using System; using System.Threading; using Christie_net.datagear.command; namespace Christie_net.daemon { public class OutboundTcpConnection { private Connection connection; public OutboundTcpConnection(Connection connection) { this.connection = connection; } public void Run() { while (true) { try { Command cmd = connection.sendQueue.Take(); switch (cmd.type) { case CommandType.CLOSE: case CommandType.FINISH: cmd.Execute(); return; default: break; } connection.Write(cmd); } catch (ThreadInterruptedException e) { Console.WriteLine(e.StackTrace); } } } } }