Click here to Skip to main content
15,910,211 members
Home / Discussions / C#
   

C#

 
AnswerRe: About charcter code pages Pin
Luc Pattyn3-Dec-09 1:06
sitebuilderLuc Pattyn3-Dec-09 1:06 
GeneralRe: About charcter code pages Pin
bhaskarsgb4-Dec-09 7:04
bhaskarsgb4-Dec-09 7:04 
QuestionRender 2d function with 16 bit resolution? Pin
Mark H Bishop2-Dec-09 14:00
Mark H Bishop2-Dec-09 14:00 
AnswerRe: Render 2d function with 16 bit resolution? Pin
Luc Pattyn2-Dec-09 14:17
sitebuilderLuc Pattyn2-Dec-09 14:17 
GeneralRe: Render 2d function with 16 bit resolution? Pin
harold aptroot2-Dec-09 22:33
harold aptroot2-Dec-09 22:33 
Generalmore thoughts Pin
Mark H Bishop3-Dec-09 3:02
Mark H Bishop3-Dec-09 3:02 
GeneralRe: more thoughts Pin
harold aptroot3-Dec-09 4:16
harold aptroot3-Dec-09 4:16 
QuestionHow do I ensure that my thread is ready before my main thread continues ? Pin
abiemann2-Dec-09 12:08
abiemann2-Dec-09 12:08 
I'm currently experiencing a race condition: my data-receive thread isn't ready by the time it's supposed to receive data

//create a thread to receive responses from the server
Thread clientThread = new Thread(new ParameterizedThreadStart(ProcessServerResponse));
clientThread.Start(RDclient);

//log activity to client window
logText("Connected to Server");

//initiate password syncronization - ProcessServerResponse() should be up and running by now
//TODO eliminate race condition
String clientRequest = "SYNC|" + strClientPassword;
Byte[] sendBytes = Encoding.ASCII.GetBytes(clientRequest);
tcpClientStream.Write(sendBytes, 0, sendBytes.Length);
tcpClientStream.Flush();


how do I ensure that my ProcessServerResponse() thread is at the .Read() before my main thread sends .Write ?

private void ProcessServerResponse(object client)
{
    TcpClient _RDclient = (TcpClient)client;
    NetworkStream tcpClientStream = _RDclient.GetStream();
    String strTemp;

    //data array to receive data
    byte[] message = new byte[Properties.Settings.Default.iReceiveBufferSize];
    int iBytesReceivedCount;

    while (true)
    {
        iBytesReceivedCount = 0;

        try
        {
            //blocks thread until server receives a message
            iBytesReceivedCount = tcpClientStream.Read(message, 0, message.Length);
        }

AnswerRe: How do I ensure that my thread is ready before my main thread continues ? Pin
Luc Pattyn2-Dec-09 13:04
sitebuilderLuc Pattyn2-Dec-09 13:04 
AnswerRe: How do I ensure that my thread is ready before my main thread continues ? Pin
Alan N2-Dec-09 13:17
Alan N2-Dec-09 13:17 
GeneralRe: How do I ensure that my thread is ready before my main thread continues ? Pin
David Skelly2-Dec-09 22:13
David Skelly2-Dec-09 22:13 
GeneralRe: How do I ensure that my thread is ready before my main thread continues ? Pin
Nicholas Butler2-Dec-09 23:20
sitebuilderNicholas Butler2-Dec-09 23:20 
GeneralRe: How do I ensure that my thread is ready before my main thread continues ? Pin
Alan N3-Dec-09 0:41
Alan N3-Dec-09 0:41 
GeneralRe: How do I ensure that my thread is ready before my main thread continues ? Pin
David Skelly3-Dec-09 4:46
David Skelly3-Dec-09 4:46 
GeneralRe: How do I ensure that my thread is ready before my main thread continues ? Pin
abiemann4-Dec-09 19:51
abiemann4-Dec-09 19:51 
QuestionAccessing ListView edit box Pin
shoelace2-Dec-09 9:48
shoelace2-Dec-09 9:48 
Questionaccess to textbox of user control Pin
farokhian2-Dec-09 9:45
farokhian2-Dec-09 9:45 
AnswerRe: access to textbox of user control Pin
Blue_Boy2-Dec-09 9:52
Blue_Boy2-Dec-09 9:52 
GeneralRe: access to textbox of user control Pin
farokhian2-Dec-09 10:27
farokhian2-Dec-09 10:27 
GeneralRe: access to textbox of user control Pin
Saksida Bojan2-Dec-09 10:34
Saksida Bojan2-Dec-09 10:34 
GeneralRe: access to textbox of user control Pin
farokhian2-Dec-09 10:57
farokhian2-Dec-09 10:57 
GeneralRe: access to textbox of user control Pin
Saksida Bojan2-Dec-09 12:02
Saksida Bojan2-Dec-09 12:02 
Question[Message Deleted] Pin
hande542-Dec-09 8:52
hande542-Dec-09 8:52 
AnswerRe: String to datetime Pin
Blue_Boy2-Dec-09 9:05
Blue_Boy2-Dec-09 9:05 
Questiondatatable Pin
farokhian2-Dec-09 6:56
farokhian2-Dec-09 6:56 

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.