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
haan jae
NA
22
27.6k
Send message to Specific Client by selecting number in comboBox
Nov 30 2011 11:24 PM
Updated:
i modified the code, now can send private message by selecting number of client in comboBox, this is done when i remove the for loop coz if use the for loop, total messages will be sent at once depends on total number of clients connected.
but still have problem that when any client disconnect and reconnect again, private message cannot send anymore.
Any help will be appreciated, thanks in advance. sorry and pls ask again if the explanation is unclear.
here is the code i tried:
void indmsgbtn_Click(object sender, EventArgs e)
{
try
{
string msg = richtxtindmsg.Text;
msg = "Private Admin Message: " + msg + "\n";
byte[] byData = System.Text.Encoding.ASCII.GetBytes(msg);
//Socket workerSocket = null;
// for (int i = 0; i < m_workerSocketList.Count; i++)
//{
Socket workerSocket = (Socket)m_workerSocketList[comboBox1.SelectedIndex];
if (workerSocket != null)
{
if (workerSocket.Connected)
{
try
{
workerSocket.Send(byData);
}
catch (SocketException ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
catch (SocketException se)
{
MessageBox.Show(se.Message);
}
}
Reply
Answers (
3
)
Why are there five tracing levels in System.Diagnostics.TraceSwitcher
Write text to notepad with format