private void Start() { quit = true; Client_State[] Clients = new Client_State[csMain.MAXCOUNT.MAX_CLIENT]; for (int i = 0; i < Clients.Length; i++) { //OtherClients 초기화 Clients[i].id = -1; } eventState eventstate = new eventState(); TCPclient = new TCPClient(Clients, eventstate.getPuzzle(), eventstate.getTrap(), eventstate.getAni()); TCPclient.TCPServerInit(); TCPclient.recvClientID(); TCPclient.GameWait(); UDPclient = new UDPClient(TCPclient.getMyID(), Clients); UDPclient.UDPServerInit(); }
/// <summary> /// The Validation. /// </summary> /// <param name="connectionType">The connectionType<see cref="string"/>.</param> /// <param name="port">The port<see cref="string"/>.</param> /// <returns>The <see cref="IWorker"/>.</returns> public IWorker Validation(string connectionType, string port) { int Port; bool isValidPort = Int32.TryParse(port, out Port); if (connectionType == "Udp") { var udpClient = new UDPClient(); if (isValidPort) { udpClient.Port = Port; } else { udpClient.Port = 80; } return(udpClient); } else if (connectionType == "Tcp") { var tcpClient = new TCPClient(); if (isValidPort) { tcpClient.Port = Port; } else { tcpClient.Port = 80; } return(tcpClient); } else { return(null); } }
private void sendFile(UDPClient clientTemp) { fileSend.sendFile(clientTemp, filePath, fileName); //Thread.Sleep(99); m_SyncContext.Post(appendMsg, DateTime.Now + "\r\n系统消息:文件 " + fileName + " 传输开始\r\n"); }