public void SendMessageToClient <T>(ClientLog client, string address, T value) { OSCMessage message = new OSCMessage(address); message.Append(value); if (client.log.Count < _loglength) { client.log.Add(String.Concat(DateTime.UtcNow.ToString(), ".", FormatMilliseconds(DateTime.Now.Millisecond), " : ", address, " ", DataToString(message.Data))); client.messages.Add(message); } else { client.log.RemoveAt(0); client.messages.RemoveAt(0); client.log.Add(String.Concat(DateTime.UtcNow.ToString(), ".", FormatMilliseconds(DateTime.Now.Millisecond), " : ", address, " ", DataToString(message.Data))); client.messages.Add(message); } client.client.Send(message); }
private void OnUserList(string command, string data) { var us = data.Split(','); isConnected = true; foreach (var cl in us) { if (cl == username) { ClientLog.Invoke("[Server]: Имя пользователя занято"); isConnected = false; return; } } ClientLog.Invoke("[Server]: Список подключенных клиентов:"); if (us.Length == 0 || (us.Length == 1 && us[0].Length == 0)) { ClientLog?.Invoke("[Server]: Вы единственный пользователь на сервере"); } foreach (var cl in us) { if (cl.Length != 0) { ClientLog.Invoke(">" + cl); } } ClientLog.Invoke("-----------------------------"); }
/// <summary> /// Creates an OSC Client (sends OSC messages) given an outgoing port and address. /// </summary> /// <param name="clientId"> /// A <see cref="System.String"/> /// </param> /// <param name="destination"> /// A <see cref="IPAddress"/> /// </param> /// <param name="port"> /// A <see cref="System.Int32"/> /// </param> public bool CreateClient(string clientId, IPAddress destination, int port) { var result = false; if (!_clients.ContainsKey(clientId)) { ClientLog clientitem = new ClientLog(); clientitem.client = new OSCClient(destination, port); clientitem.log = new List <string>(); clientitem.messages = new List <OSCMessage>(); _clients.Add(clientId, clientitem); // Send test message string testaddress = "/test/alive/"; SendMessageToClient(clientId, testaddress, "OK"); result = true; } //OSCMessage message = new OSCMessage(testaddress, destination.ToString()); //message.Append(port); //message.Append("OK"); //_clients[clientId].log.Add(String.Concat(DateTime.UtcNow.ToString(), ".", // FormatMilliseconds(DateTime.Now.Millisecond), " : ", // testaddress, " ", DataToString(message.Data))); //_clients[clientId].messages.Add(message); //_clients[clientId].client.Send(message); return(result); }
public void Start() { isConnected = false; try { ClientLog.Invoke(String.Format("[Server]: Подключение к {0}", this.serverHost)); cSocket = new Socket(SocketType.Stream, ProtocolType.Tcp); cSocket.Connect(this.serverHost, port); net = new NetMessaging(cSocket); net.LoginCmdReceived += OnLogin; net.UserListCmdReceived += OnUserList; net.StartCmdReceived += OnStart; net.MessageCmdReceived += OnMessage; communicate = new Thread(() => { try { net.Communicate(); } catch (Exception) { ClientLog.Invoke("[Server]: Не удалось получить данные. Завершение соединения..."); } }); communicate.Start(); } catch (Exception) { ClientLog.Invoke("[Server]: Что-то пошло не так... :("); } }
public void CreateClient(string clientId, IPAddress destination, int port, bool connect = true) { ClientLog clientitem = new ClientLog(); clientitem.client = new OSCClient(destination, port, connect); clientitem.log = new List <string>(); clientitem.messages = new List <OSCMessage>(); _clients.Add(clientId, clientitem); // Send test message string testaddress = "/test/alive/"; OSCMessage message = new OSCMessage(testaddress, destination.ToString()); message.Append(port); message.Append("OK"); _clients[clientId].log.Add(String.Concat(DateTime.UtcNow.ToString(), ".", FormatMilliseconds(DateTime.Now.Millisecond), " : ", testaddress, " ", DataToString(message.Data))); _clients[clientId].messages.Add(message); if (connect) { _clients[clientId].client.Send(message); } }
private void OnMessage(string command, string data) { if (isConnected) { ClientLog.Invoke(String.Format("{0}", data)); } }
private void OnStart(string command, string data) { if (isConnected) { ClientLog.Invoke("[Server]: Вы можете писать сообщения!"); GoMessaging(); } }
/// <summary> /// Log fatal error & display to user /// </summary> /// <param name="ex"></param> static void LogUnexpectedError(Exception ex) { string msg = DebugLog.FormatExceptionMessage(ex); ClientLog.LogFatalErrorMessage(msg); // special log ClientLog.Message(msg); // regular log MessageBoxMx.ShowError(msg); // show to user }
public Tuple <ClientLog, List <string> > ConvertCsvToClientDataModel(List <string> data, LatencyConversionModel latencyConversionModel) { try { if (data == null || !data.Any()) { return(new Tuple <ClientLog, List <string> >(new ClientLog(), new List <string>())); } if (latencyConversionModel == null) { latencyConversionModel = new LatencyConversionModel(); } var clientReport = new ClientLog(); data.RemoveAt(0); var clientReportAndIssues = data .Select(line => LineSplitter(line).ToArray()) .Select(lineParams => { try { var row = new ClientModelRow(); row.InvoiceNumber = latencyConversionModel.LatencyConversionTable.ContainsKey(lineParams[20]) && latencyConversionModel.LatencyConversionTable[lineParams[20]].ContainsKey(int.Parse(lineParams[15])) ? latencyConversionModel.LatencyConversionTable[lineParams[20]][int.Parse(lineParams[15])] : int.Parse(lineParams[15]); row.InvoiceDate = TryParsingDateTime(lineParams[19], true); row.AmountDue = float.Parse(lineParams[16]); row.PaymentTerms = int.Parse(lineParams[14]); row.ClientId = lineParams[20]; row.ClientNumber = int.Parse(lineParams[5]); row.CompanyNumber = int.Parse(lineParams[4]); return(new Tuple <ClientModelRow, string>(row, string.Empty)); } catch (Exception e) { return(new Tuple <ClientModelRow, string>(null, $"Error parsing content from client file in row: {string.Join(",", lineParams)}. Excpetion: {e.Message}")); } }).ToList(); clientReport.ClientReport = clientReportAndIssues .Select(x => x.Item1) .Where(x => x != null) .ToList(); var issues = clientReportAndIssues .Select(x => x.Item2) .Where(x => x != null) .ToList(); return(new Tuple <ClientLog, List <string> >(clientReport, issues)); } catch (Exception e) { MessageBox.Show($@"Failed parsing client report. InnerMessage: {e.Message}"); throw; } }
public ClientLogDto(ClientLog entity) { LogTag = entity.LogTag; LogInfo = entity.LogInfo; LogSrcInfo = entity.LogSrcInfo; ClientInfo = entity.ClientInfo; State = entity.State; Remark = entity.Remark; }
//обработчик для конца парсинга пакета. protected void CheckEndPacket__(int packetId, MemoryStream ms) { if (ms.Position != ms.Length) { Debug.Log("Packet read no finish: id=" + packetId + " ms.Position= " + ms.Position + " ms.Length = " + ms.Length); ClientLog.LogBuffer(ms.ToArray(), 0); } }
private void ParsePacket(byte[] packetData, NetworkManager netManager) { int packetType = packetData[0]; try { IncomingPacket packet = null; //remove header byte[] tmp = new byte[packetData.Length - 1]; Array.Copy(packetData, 1, tmp, 0, tmp.Length); packetData = tmp; switch (packetType) { ///////////////////////////////// case 4: packet = new SystemMessage00(); break; case 5: packet = new KeepAliveAnswer00(netManager); break; case 6: packet = new AuthSuccess00(netManager); break; case 7: packet = new PlayerInfo00(); break; case 8: packet = new SayToChat00(); break; //////////////////////////////////////// default: ClientLog.LogPacket("UNKNOWN PACKET => ", packetType, packetData, true); break; } if (packet != null) { packet.SetData(packetType, packetData); } ClientLog.LogPacket("client<=server ", packetType, packetData, false); } catch (Exception exc) { ClientLog.LogPacket("PROBLEM PARSING PACKET => ", packetType, packetData, true); if (exc.Message != null) { Debug.Log("ERR: " + exc.Message); } } }
/// <summary> /// Creates an OSC Client (sends OSC messages) given an outgoing port and address. /// </summary> /// <param name="clientId"> /// A <see cref="System.String"/> /// </param> /// <param name="destination"> /// A <see cref="IPAddress"/> /// </param> /// <param name="port"> /// A <see cref="System.Int32"/> /// </param> public void CreateClient(string clientId, IPAddress destination, int port) { ClientLog clientitem = new ClientLog(); clientitem.client = new OSCClient(destination, port); clientitem.log = new List <string>(); clientitem.messages = new List <OSCMessage>(); _clients.Add(clientId, clientitem); }
private void FTPClient_ClientLogEvent(object sender, ClientLogArgs args) { ClientLog.Dispatcher.Invoke(new Action(() => { ClientLog.AppendText(args.Message + Environment.NewLine); ClientLog.Focus(); ClientLog.CaretIndex = ClientLog.Text.Length; ClientLog.ScrollToEnd(); })); }
private void AddLog(string text) { var formatted = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " " + text; if (ClientLog.Count > 400) { ClientLog.RemoveAt(0); } ClientLog.Add(formatted); }
/** * */ private void ReceiveMsgCallback(IAsyncResult receiveRes) { if (!IsConnected()) { ClientLog.LogError("ReceiveMsgCallback : the socket is not connected!!!"); return; } MsgReceiveHelper receiveHelper = null; try { int _recSize = this._socketClient.EndReceive(receiveRes); if (_recSize > 0) { receiveHelper = (MsgReceiveHelper)receiveRes.AsyncState; this.DecodeMsg(receiveHelper.buffer, _recSize); } // < 0, the remote socket is close... else { SetShowNetworkError(1, 0, SocketError.SocketError); ClientLog.LogError("Socket EndReceive failed, the size is 0. The remote socket is closed. Disconnect..."); this.Close(); return; } } // catch (SocketException se) { SetShowNetworkError(2, se.ErrorCode, se.SocketErrorCode); ClientLog.LogError("receive msg failed : " + se.ToString()); ClientLog.LogError("Socket EndReceive Exception, ErrorCode = " + se.ErrorCode.ToString() + ", SocketErrorCode = " + se.SocketErrorCode.ToString()); // Disconnect, WSAEWOULDBLOCK if (!se.SocketErrorCode.Equals(SocketError.WouldBlock)) { ClientLog.LogError("Socket fatal exception, disconnect..."); this.Close(); return; } } catch (Exception e) { SetShowNetworkError(3, 0, SocketError.SocketError); ClientLog.LogError("receive msg failed : " + e.ToString()); } // finally { if (receiveHelper != null) { receiveHelper.socket.BeginReceive(receiveHelper.buffer, 0, receiveHelper.buffer.Length, SocketFlags.None, new AsyncCallback(ReceiveMsgCallback), receiveHelper); } else { this.StartRecevieMsg(); } } }
/// <summary> /// Detailed message loging /// </summary> /// <param name="msg"></param> public static void LogDetailedMessage(string msg) { if (!LogDetailedMessages) { return; } ClientLog.Message(msg); return; }
/************************************************************************/ public void CreateClient(IPAddress destination, int port) { ClientLog clientitem = new ClientLog(); clientitem.client = new OSCClient(destination, port); clientitem.log = new List<string>(); clientitem.messages = new List<OSCMessage>(); _clients.Add(clientId, clientitem); // Send test message //send ("ca"); }
/// <summary> /// Handler invoked on Application exit to attempt to dispose of the user session /// If /// </summary> /// <param name="sender"></param> /// <param name="e"></param> static void ApplicationExit(object sender, EventArgs e) { try { DebugLog.Message("Exiting"); ServiceFacade.ServiceFacade.DisposeSession(); } catch (Exception ex) { ClientLog.Message(DebugLog.FormatExceptionMessage(ex)); // just log it } }
static int TryFindAppIdInternal() { var steam_app_id = Environment.GetEnvironmentVariable("SteamAppId"); if (steam_app_id != null) { try { return(Int32.Parse(steam_app_id)); } catch { } } ClientLog.WriteLine("SteamAppId not set."); // Try and read steam_appid.txt // steamclient does this in a number of ways... // It will first check the local working directory for steam_appid.txt // It will then check in the host apps directory for steam_appid.txt // Otherwise it will just be an empty string try { steam_app_id = File.ReadAllText("steam_appid.txt"); return(Int32.Parse(steam_app_id)); } catch { ClientLog.WriteLine("steam_appid.txt not in current working directory."); } try { var main_exe = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; var exe_path = Path.GetDirectoryName(main_exe); ClientLog.WriteLine("note: exe_path: '{0}'", exe_path); steam_app_id = Path.Combine(exe_path, "steam_appid.txt"); return(Int32.Parse(steam_app_id)); } catch { ClientLog.WriteLine("steam_appid.txt not found in root exe folder."); } return(0); }
public static void TryFindAppId(int pipe_id) { var found = TryFindAppIdInternal(); if (found == 0) { return; } ClientLog.WriteLine("Found appid {0}", found); Server.SetAppId(pipe_id, found); }
public static object CallSerializedFunction(int pipe_id, int client_id, int interface_id, string name, object[] args) { // The pipeid that comes in here is the real unique pipe_id, the message PipeId is the clientside unique pipeid if (client_id == -1 && interface_id == -1) { // TODO: handle special server related functions switch (name) { case "CreateClient": { return(CreateNewClient(pipe_id)); } case "CreateInterface": { return(CreateInterfaceNoUser(pipe_id, (string)args[0]).InterfaceId); } case "NextCallback": { return(CallbackHandler.GetCallbackForPipe(pipe_id)); } } return(null); } else if (client_id == -1 && interface_id != -1) { var iface = NoUserInterface[interface_id]; var mi = iface.Implementation.methods.Find(x => x.Name == name); if (mi != null) { return(mi.Invoke(NoUserInterface[interface_id], args)); } ClientLog.WriteLine("Unable to find method \"{0}\" from interface \"{1}\"", name, iface.Implementation.name); return(null); } if (!GetClient(client_id).ConnectedPipes.Contains(pipe_id)) { ClientLog.WriteLine("Pipe {0} is not connected to Client {1}", pipe_id, client_id); return(null); } return(GetClient(client_id).CallSerializedFunction(pipe_id, interface_id, name, args)); }
// public override bool HaveAllMoves(){ // // bool allMoves = true; // // foreach(GameObject wizard in wizards){ // if(wizard.activeInHierarchy){ // allMoves = allMoves && // wizard.GetComponent<WizardManager>().nextMove != WizardManager.MOVES.OFF; //// Debug.Log(wizard.GetComponent<WizardManager>().nextMove.ToString()); // } // } // // return allMoves; // } //NETWORK METHODS // public override void StartGame(){ // // foreach(GameObject wizard in wizards){ // if(wizard.activeInHierarchy){ // JSONNode response = WizardToJSON(wizard); // SendPacket(client, GameManager.instance.Mode.ToString(), response); // } // } // // SendPacket(client, START_GAME, new JSONClass()); // //// JSONClass jsonData = new JSONClass(); //// jsonData["hello"] = "temp"; //// //// SendPacket(client, START_GAME, jsonData); // } // // public override void StartRound(){ // // foreach(GameObject wizard in wizards){ // if(wizard.activeInHierarchy){ // JSONNode response = WizardToJSON(wizard); // SendPacket(client, GameManager.instance.Mode.ToString(), response); // } // } // } // // public override void SendDead(GameObject wizard){ // Debug.Log("SENDDEAD"); // if(wizard.activeInHierarchy){ // JSONNode response = WizardToJSON(wizard); // SendPacket(client, WIZARD_DEAD, response); // } // } // void __CLIENT_CONNECTED(JSONNode jsonData){ // REG(jsonData); // } // void REG(JSONNode jsonData){ // Debug.Log("REG: " + jsonData[WIZARD_NAME]); // ActivateWizard(numWizards, jsonData[WIZARD_NAME], jsonData[PLAYER_ID].AsInt); // // JSONNode response = WizardToJSON(wizards[numWizards - 1]); // // SendPacket(client, GameManager.instance.Mode.ToString(), response); // } // // void PLAYER_MOVE(JSONNode jsonData){ //// Debug.Log("PLAYER_MOVE: " + jsonData[GLUE_PLAYER_MOVE]); // // GameObject wizard = wizardMap[Convert.ToInt64(jsonData[PLAYER_ID])]; // // WizardManager wizMan = wizard.GetComponent<WizardManager>(); // // wizMan.nextMove = // (WizardManager.MOVES) Enum.Parse(typeof(WizardManager.MOVES), jsonData[GLUE_PLAYER_MOVE]); // // // wizMan.moveText.text = "GOT MOVE!"; // // if(wizMan.nextMove == WizardManager.MOVES.ATTACKS){ // wizMan.attackNum = wizardMap[Convert.ToInt64(jsonData[WIZARD_TARGET])].GetComponent<WizardManager>().index; // } // } // // JSONClass WizardToJSON(GameObject wizard){ // WizardManager wizman = wizard.GetComponent<WizardManager>(); // // JSONClass jsonData = new JSONClass(); // // jsonData[WIZARD_NAME] = wizard.name; // // jsonData["POSITION"] = wizard.transform.position.ToString(); // jsonData["POWER"] = wizman.Power + ""; // jsonData["HEALTH"] = wizman.Health + ""; // jsonData[PLAYER_ID] = wizman.id + ""; // //// Debug.Log(jsonData); // // return jsonData; // } //OSC STUFF /// <summary> /// Creates an OSC Client (sends OSC messages) given an outgoing port and address. /// </summary> /// <param name="clientId"> /// A <see cref="System.String"/> /// </param> /// <param name="destination"> /// A <see cref="IPAddress"/> /// </param> /// <param name="port"> /// A <see cref="System.Int32"/> /// </param> public ClientLog CreateClient(ClientLog client, IPAddress destination, int port) { client.client = new OSCClient(destination, port); client.log = new List <string>(); client.messages = new List <OSCMessage>(); JSONClass jsonData = new JSONClass(); jsonData["hello"] = "JS!"; SendPacket(client, CLIENT_CONNECTED, jsonData); return(client); }
void SendPacket(ClientLog client, string label, JSONNode jsonData) { Debug.Log("label: " + label); string testaddress = label; OSCMessage message = new OSCMessage(testaddress, jsonData.ToString()); // message.Append(jsonData.ToString()); client.messages.Add(message); client.client.Send(message); }
public void SendMessageToClient(ClientLog client, OSCMessage message) { Debug.Log("msgending"); if (client.log.Count < _loglength) { client.messages.Add(message); } else { client.log.RemoveAt(0); client.messages.RemoveAt(0); client.messages.Add(message); } client.client.Send(message); }
public void SendMessage(byte[] bytes) { try { if (!this.IsConnected()) { ClientLog.LogError("server is not connected!"); } else { _socketClient.BeginSend(bytes, 0, bytes.Length, SocketFlags.None, SendMsgCallback, _socketClient); } } catch (Exception ex) { ClientLog.LogError(ex.ToString()); } }
/// <summary> /// Get splash image from server and display /// </summary> public void SetSplashImage() { try { string splashImageDir = Splash.Instance.IniFile.Read("SplashImageDir"); // ClientLog.Message("SplashImageDir: " + splashImageDir); // debug string tok = Splash.Instance.IniFile.Read("SplashImageCount"); // ClientLog.Message("SplashImageCount: " + tok); // debug int splashCount = 0; Int32.TryParse(tok, out splashCount); int imageIdx = 1; tok = Splash.Instance.UserIniFile.Read("SplashImageIndex"); // ClientLog.Message("SplashImageIndex: " + tok); // debug if (tok != "") { imageIdx = Int32.Parse(tok) + 1; if (imageIdx > splashCount) { imageIdx = 1; } } Splash.Instance.UserIniFile.Write("SplashImageIndex", imageIdx.ToString()); // int ms = System.DateTime.Now.Millisecond; // int imageIdx = ms % splashCount + 1; // index of image to use string splashImagePath = // name of splash file on server splashImageDir + @"\Nature" + imageIdx.ToString() + ".jpg"; int t0 = TimeOfDay.Milliseconds(); if (File.Exists(splashImagePath)) { Splash.Instance.SetImage(new Bitmap(splashImagePath)); Splash.Instance.Invalidate(); Application.DoEvents(); } t0 = TimeOfDay.Milliseconds() - t0; } catch (Exception ex) { ClientLog.Message("Splash display error: " + ex.Message); } }
public JsonResult DeleteCandidate(long id) { long clientId = -1; if (!long.TryParse(Session["ClientId"].ToString(), out clientId)) { return(Json(new { rs = -1, msg = "Permission Denied" }, JsonRequestBehavior.AllowGet)); } var candidate = db.Candidates.FirstOrDefault(s => s.CandidateId == id && s.ClientId == clientId); if (candidate == null) { return(Json(new { rs = -1, msg = "Permission Denied" }, JsonRequestBehavior.AllowGet)); } if (candidate.Status != "Initial") { return(Json(new { rs = -1, msg = "Error: Can not delete candidate information when they submitted" }, JsonRequestBehavior.AllowGet)); } // remove all company and reference of this candidate var companies = db.CompanyInfoes.Where(s => s.CandidateId == candidate.CandidateId); foreach (var com in companies) { var refes = db.ReferenceInfoes.Where(s => s.CompanyInfoId == com.CompanyInfoId); foreach (var refe in refes) { db.ReferenceInfoes.Remove(refe); } db.CompanyInfoes.Remove(com); } db.Candidates.Remove(candidate); var r = db.SaveChanges(); var log = new ClientLog() { RecruiterId = candidate.RecruiterId, LogType = "Delete Candidate", LogTime = DateTime.Now, ClientId = candidate.ClientId, LogContent = "Delete candidate " + candidate.FirstName + " " + candidate.MiddleName + " " + candidate.LastName }; db.ClientLogs.Add(log); db.SaveChanges(); return(Json(new { rs = r, msg = "" }, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateCandidate(CandidateSimpleInfo can) { long clientId = -1; if (!long.TryParse(Session["ClientId"].ToString(), out clientId)) { return(Json(new { rs = -1, msg = "Permission Denied" }, JsonRequestBehavior.AllowGet)); } long recruiterId = -1; if (!long.TryParse(Session["RecruiterId"].ToString(), out recruiterId)) { return(Json(new { rs = -1, msg = "Permission Denied" }, JsonRequestBehavior.AllowGet)); } var candidate = db.Candidates.First(s => s.CandidateId == can.CandidateId && s.ClientId == clientId); if (candidate == null) { return(Json(new { rs = -1, msg = "Permission Denied" }, JsonRequestBehavior.AllowGet)); } if (candidate.Status != "Initial") { return(Json(new { rs = -1, msg = "Error: Can not edit candidate information when they submitted" }, JsonRequestBehavior.AllowGet)); } candidate.FirstName = can.FirstName; candidate.MiddleName = can.MiddleName; candidate.LastName = can.LastName; candidate.Email = can.Email; candidate.PhoneNumber = can.PhoneNumber; candidate.JobTitle = can.JobTitle; candidate.JobLevel = can.JobLevel; db.Entry(candidate).State = EntityState.Modified; var r = db.SaveChanges(); var log = new ClientLog() { RecruiterId = candidate.RecruiterId, LogType = "Update Candidate", LogTime = DateTime.Now, ClientId = candidate.ClientId, LogContent = "Update candidate " + can.FirstName + " " + can.MiddleName + " " + can.LastName }; db.ClientLogs.Add(log); db.SaveChanges(); return(Json(new { rs = candidate.CandidateId, msg = r }, JsonRequestBehavior.AllowGet)); }
public void Run(dynamic caller) { ClientLog.Progress(caller, 0, "Gathering defualt emails to update"); var brandings = AutoDal.GetFilteredList <Branding>("EmailFromAddress = '*****@*****.**' or EmailFromName = 'goodpractice.net'"); var count = brandings.Count; var increment = 100 / (double)count; var progress = (double)1; var index = 0; foreach (var branding in brandings) { progress += increment; ClientLog.Progress(caller, (int)progress, "Replacing default email #" + index++); branding.EmailFromAddress = "*****@*****.**"; branding.EmailFromName = "goodpractice.com"; branding.Save(); } }
// #if USE_THREAD_RECEIVE_MSG void RecvThreadDoWork() { byte[] _buffer = new byte[DEFAULT_RECEIVE_SIZE]; while (mThreadWork) { try { int _recSize = this._socketClient.Receive(_buffer, DEFAULT_RECEIVE_SIZE, SocketFlags.None); if (_recSize > 0) { this.DecodeMsg(_buffer, _recSize); } // < 0, the remote socket is close... else { SetShowNetworkError(1, 0, SocketError.SocketError); ClientLog.LogError("Socket EndReceive failed, the size is 0. The remote socket is closed. Disconnect..."); this.Close(); break; } } catch (SocketException se) { if (se.SocketErrorCode == SocketError.WouldBlock || se.SocketErrorCode == SocketError.IOPending || se.SocketErrorCode == SocketError.NoBufferSpaceAvailable) { // socket buffer is probably empty, wait and try again Thread.Sleep(50); } else { SetShowNetworkError(2, se.ErrorCode, se.SocketErrorCode); ClientLog.LogError("receive msg failed : " + se.ToString()); ClientLog.LogError("Socket EndReceive Exception, ErrorCode = " + se.ErrorCode.ToString() + ", SocketErrorCode = " + se.SocketErrorCode.ToString()); ClientLog.LogError("Socket fatal exception, disconnect..."); this.Close(); break; } } Thread.Sleep(1); } // mRecvThread.Join(); }
public virtual void UpdateClientLog(ClientLog entity) { entityDao.UpdateClientLog(entity); }
public virtual void DeleteClientLog(ClientLog entity) { entityDao.DeleteClientLog(entity); }
public virtual void CreateClientLog(ClientLog entity) { entityDao.CreateClientLog(entity); }