Click here to Skip to main content
15,923,051 members
Home / Discussions / C#
   

C#

 
QuestionProblem to if communicate with video capture device! Pin
Alex_xso26-Jan-09 3:27
Alex_xso26-Jan-09 3:27 
AnswerRe: Problem to if communicate with video capture device! Pin
Mustafa Ismail Mustafa26-Jan-09 3:57
Mustafa Ismail Mustafa26-Jan-09 3:57 
GeneralRe: Problem to if communicate with video capture device! Pin
Alex_xso26-Jan-09 5:02
Alex_xso26-Jan-09 5:02 
Questionclient/server problem [modified] Pin
staticv26-Jan-09 3:20
staticv26-Jan-09 3:20 
AnswerRe: client/server problem Pin
Mustafa Ismail Mustafa26-Jan-09 3:55
Mustafa Ismail Mustafa26-Jan-09 3:55 
GeneralRe: client/server problem Pin
staticv26-Jan-09 4:09
staticv26-Jan-09 4:09 
GeneralRe: client/server problem Pin
Mustafa Ismail Mustafa26-Jan-09 4:28
Mustafa Ismail Mustafa26-Jan-09 4:28 
GeneralRe: client/server problem [modified] Pin
staticv26-Jan-09 4:37
staticv26-Jan-09 4:37 
sorry I posted the old code Smile | :)

heres the modified one where i send messages to all.

btw i'm going to read the article you given

while you tell me if the code is correct or not Smile | :)


void RunClient()
{
    // Create the stream classes
    StreamReader readerStream = new StreamReader(clientSocket.GetStream());
    NetworkStream writerStream = clientSocket.GetStream();

    string returnData = readerStream.ReadLine();
    string userName = returnData;

    // Add a user
    users.Add(userName, clientSocket);

    Console.WriteLine("Welcome " + userName + " to the Server");

    while (true)
    {
        returnData = readerStream.ReadLine();
        String tempData = returnData.ToLower();

        if (tempData.IndexOf("quit") > -1)
        {
            Console.WriteLine("Bye Bye " + userName);
            break;
        }

        Console.WriteLine(userName + ": " + returnData);
        returnData += "\r\n";

        byte[] dataWrite = Encoding.ASCII.GetBytes(returnData);

        TcpClient[] tcpClients = new TcpClient[users.Count];
        users.Values.CopyTo(tcpClients, 0);
        for (int i = 0; i < tcpClients.Length; i++)
        {
            NetworkStream tempWriteStream = tcpClients[i].GetStream();
            tempWriteStream.Write(dataWrite, 0, dataWrite.Length);
            tempWriteStream = null;
        }
    }

    clientSocket.Close();
}


Top Web Hosting Providers[^]

Do, or do not. There is no 'try'.

modified on Monday, January 26, 2009 10:43 AM

GeneralRe: client/server problem Pin
Mustafa Ismail Mustafa26-Jan-09 4:40
Mustafa Ismail Mustafa26-Jan-09 4:40 
GeneralRe: client/server problem Pin
staticv26-Jan-09 4:42
staticv26-Jan-09 4:42 
GeneralRe: client/server problem Pin
Mustafa Ismail Mustafa26-Jan-09 4:44
Mustafa Ismail Mustafa26-Jan-09 4:44 
GeneralRe: client/server problem Pin
staticv26-Jan-09 4:46
staticv26-Jan-09 4:46 
QuestionIn a service application, where do I add the functions that it should perform? Pin
anahita8726-Jan-09 1:24
anahita8726-Jan-09 1:24 
AnswerRe: In a service application, where do I add the functions that it should perform? Pin
musefan26-Jan-09 2:57
musefan26-Jan-09 2:57 
AnswerRe: In a service application, where do I add the functions that it should perform? Pin
#realJSOP26-Jan-09 4:57
professional#realJSOP26-Jan-09 4:57 
Questionvalidation Pin
abu rakan26-Jan-09 0:44
abu rakan26-Jan-09 0:44 
AnswerRe: validation Pin
musefan26-Jan-09 0:54
musefan26-Jan-09 0:54 
GeneralRe: validation Pin
Manas Bhardwaj26-Jan-09 0:59
professionalManas Bhardwaj26-Jan-09 0:59 
GeneralRe: validation Pin
musefan26-Jan-09 1:05
musefan26-Jan-09 1:05 
GeneralRe: validation Pin
butchzn27-Jan-09 0:47
butchzn27-Jan-09 0:47 
AnswerRe: validation Pin
Christian Graus26-Jan-09 1:03
protectorChristian Graus26-Jan-09 1:03 
GeneralRe: validation Pin
abu rakan26-Jan-09 10:49
abu rakan26-Jan-09 10:49 
GeneralRe: validation Pin
Kaushal Arora26-Jan-09 19:41
Kaushal Arora26-Jan-09 19:41 
Questionask about the easy way to define and use color array Pin
Seraph_summer26-Jan-09 0:05
Seraph_summer26-Jan-09 0:05 
AnswerRe: ask about the easy way to define and use color array Pin
Christian Graus26-Jan-09 0:17
protectorChristian Graus26-Jan-09 0:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.