|
-
Mar 31st, 2004, 01:47 PM
#1
Thread Starter
Lively Member
Client Server Application
Hello Everybody:
I have built a client server example using socket class where the server sends data to all the clients simultaneously. Now I want to send the data to that or one client when selected.. I have written the code to send the data to all clients. How do I modify the code to send the data to one client when selected...
private void SendDataToAllClient(string str)
{
foreach (int sKey in socketHolder.Keys)
{
Socket s = (Socket)socketHolder[sKey];
if(s.Connected)
{
Byte[] byteData = ASCII.GetBytes(str.ToCharArray());
try
{
s.Send(byteData, byteData.Length, 0);
}
catch
{
// remove the bad client
CloseTheThread(sKey);
}
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|