TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
YAKOV
NA
1
0
Loosing pefix of the messages when append to textbox
Nov 2 2009 6:01 AM
I developed program that has 2 listening sockets and 2 text boxes for incoming messages and outgoing messages. Program receives messages from sockets connected to first listening socket and sends them to all sockets connected to second listening socket. When a message is appended to a textbox to the message is added a prefix. For some of the messages displayed the prefix disappears. Also some messages are not sent out. I use method send with while loop to assure that the messages are sent. There are not exceptions. Please Help. Below are the codes. public void AppendMesToOutgTB(int indexOfSocket, eServerClient TypeOfSocket, string Message) { string Clt = "Clt"; string Srv = "Srv"; string Sep = ":"+Environment.NewLine; Socket workerSocket; StringBuilder sb = new StringBuilder(1000); //string Addr;// = ((IPEndPoint)workerSocket.RemoteEndPoint).Address.ToString(); switch (TypeOfSocket) { case eServerClient.eClient: //if (!m_workerClientSocketList.IsLoginOk(indexOfSocket)) //break; workerSocket = (Socket)m_workerClientSocketList[indexOfSocket]; //Addr = ((IPEndPoint)workerSocket.RemoteEndPoint).Address.ToString(); sb.Append(Clt);// + Addr + Sep + Message + Environment.NewLine); sb.Append(((IPEndPoint)workerSocket.RemoteEndPoint).Address.ToString());// + Sep + Message + Environment.NewLine); sb.Append(Sep);// + Message + Environment.NewLine); sb.Append(Message);// + Environment.NewLine); sb.Append(Environment.NewLine); tbOutgoingMes.AppendText(sb.ToString()); break; case eServerClient.eServer: workerSocket = (Socket)m_workerServerSocketList[indexOfSocket]; sb.Append(Srv);// + Addr + Sep + Message + Environment.NewLine); sb.Append(((IPEndPoint)workerSocket.RemoteEndPoint).Address.ToString());// + Sep + Message + Environment.NewLine); sb.Append(Sep);// + Message + Environment.NewLine); sb.Append(Message);// + Environment.NewLine); sb.Append(Environment.NewLine); tbOutgoingMes.AppendText(sb.ToString()); break; } } public void AppendMesToIncTB(Socket workerSocket, string szData) { string Clt = "Clt"; string Srv = "Srv"; string Sep = ":"+Environment.NewLine; StringBuilder sb = new StringBuilder(1000); if (m_workerClientSocketList.Contains(workerSocket)) { sb.Append(Clt);// + Addr + Sep + Message + Environment.NewLine); sb.Append(((IPEndPoint)workerSocket.RemoteEndPoint).Address.ToString());// + Sep + Message + Environment.NewLine); sb.Append(Sep);// + Message + Environment.NewLine); sb.Append(szData);// + Environment.NewLine); sb.Append(Environment.NewLine); tbIncomingMes.AppendText(sb.ToString()); } else if (m_workerServerSocketList.Contains(workerSocket)) { sb.Append(Srv);// + Addr + Sep + Message + Environment.NewLine); sb.Append(((IPEndPoint)workerSocket.RemoteEndPoint).Address.ToString());// + Sep + Message + Environment.NewLine); sb.Append(Sep);// + Message + Environment.NewLine); sb.Append(szData);// + Environment.NewLine); sb.Append(Environment.NewLine); tbIncomingMes.AppendText(sb.ToString()); } }
Reply
Answers (
2
)
Problem in dynamic sql - Table Adapters C# 2008
Short Cut Keys for Button