view daemon/Connection.cs @ 10:5f726dc31874

add Connection class
author riono <e165729@ie.u-ryukyu.ac.jp>
date Tue, 17 Nov 2020 19:34:44 +0900
parents
children 1f7d4f168b89
line wrap: on
line source

using System;
using System.Collections.Concurrent;
using System.IO;
using System.Net.Sockets;
using Christie_net.datagear.command;

namespace Christie_net.daemon {
public class Connection {
    public Socket socket;
    public string name;
    public CodeGearManager cgm;
    public ConcurrentQueue<Command> sendQueue = new ConcurrentQueue<Command>();
    public bool sendManager = true;
    private object syncObject = new object();
    
    public Connection(Socket socket, CodeGearManager cgm) {
        this.socket = socket;
        this.cgm = cgm;
    }
    
    public Connection(){}

    public void SendCommand(Command cmd) {
        sendQueue.Enqueue(cmd);
    }

    public string GetInfoString() {
        return socket.
    }

    public void Close() {
        socket
    }

    public void Write(Command cmd) {
        MemoryStream stream = cmd.Convert();

        while (stream.) {
            
        }
    }
}
}