public ManagerComunicationController(DataReceiverController dataReciv, DataCacheController dataCache, FileExportController fileExport, DataSenderController dataSend, int port ) { Console.WriteLine("manager "); this.dataReciv = dataReciv; this.dataCache = dataCache; this.fileExport = fileExport; this.dataSend = dataSend; this.comManag = new AComunicationManager(); this.managentList = new List <NetWorkContoroller>(); // dataReceiveThreadの初期化 //this.dataReceiveThread = new System.Threading.Thread(this.comManag.dataReceivThreadAction); // string ipString = "0.0.0.0"; IPAddress ipAdd = IPAddress.Parse(ipString); //int port = 6001; this.listener_ = new TcpListener(ipAdd, port); this.listener_.Start(); // management受け入れのスレッドの起動 System.Threading.ThreadPool.QueueUserWorkItem(acceptManagemet); System.Threading.ThreadPool.QueueUserWorkItem(dataManagementThreadAction); }
// コンストラクタ public DataReceiverController(DataCacheController dataCache, FileExportController fileExport, DataSenderController dataSender) { this.dataCache = dataCache; this.fileExport = fileExport; this.dataSender = dataSender; }
public static void Main(string[] args) { Console.WriteLine("Hello World!"); int serverPort = 0; int managerPort = 0; if (args.Length > 0) { serverPort = Int32.Parse(args[0]); managerPort = Int32.Parse(args[1]); } /* Debug */ // server -> server /* * int connectPort; * int recievePort; * if (args.Length > 0) * { * // サーバプロセス * connectPort = 6501; * recievePort = 6502; * } * else { * connectPort = -1; // for Client * recievePort = 6501; * } */ //int recievePort = 6501; Console.WriteLine("server port " + serverPort + " / manager port " + managerPort); FileExportController fileCtl = new FileExportController(); DataCacheController cache = new DataCacheController(); // DataSenderController sender = new DataSenderController(cache, recievePort); DataSenderController sender = new DataSenderController(cache, serverPort); DataReceiverController receiver = new DataReceiverController(cache, fileCtl, sender); //ManagerComunicationController manager = new ManagerComunicationController(receiver,cache,fileCtl,sender, 6901); ManagerComunicationController manager = new ManagerComunicationController(receiver, cache, fileCtl, sender, managerPort); /* Debug */ // クライアント用ポートの設定 /* * if (connectPort > 0) * { * // 接続先IPポートを設定 * manager.startServerComumnication("127.0.0.1", connectPort); * } * else * { * manager.startClietCommunication(6001); * * } */ }