Click here to Skip to main content
15,925,250 members
Home / Discussions / C#
   

C#

 
AnswerRe: Declaration in C# Pin
Luc Pattyn28-Oct-07 5:14
sitebuilderLuc Pattyn28-Oct-07 5:14 
GeneralRe: Declaration in C# Pin
deviduttayahoo28-Oct-07 22:02
deviduttayahoo28-Oct-07 22:02 
GeneralRe: Declaration in C# Pin
Urs Enzler28-Oct-07 22:55
Urs Enzler28-Oct-07 22:55 
GeneralRe: Declaration in C# Pin
Luc Pattyn29-Oct-07 1:58
sitebuilderLuc Pattyn29-Oct-07 1:58 
AnswerRe: Declaration in C# Pin
Scott Dorman28-Oct-07 5:25
professionalScott Dorman28-Oct-07 5:25 
GeneralRe: Declaration in C# Pin
deviduttayahoo28-Oct-07 22:03
deviduttayahoo28-Oct-07 22:03 
AnswerRe: Declaration in C# Pin
Steve Echols28-Oct-07 5:26
Steve Echols28-Oct-07 5:26 
QuestionNew to C# - Socket, Read/Write problem. Pin
unknown_Sheep28-Oct-07 4:25
unknown_Sheep28-Oct-07 4:25 
Hello, I'm new to both C# and sockets. I'm working on a program, that right now only read data from localhost and pass it directly over to a SOCKS-server on another computer.

Im running each connection in a separete thread. Problem is, I need to know when the client and server is done sending data. Right now it goes in a loop which takes up 100% CPU, not too good i guess. How can i tell when the communication is finished?

Also, since it takes up 100% CPU I guess its going through this loop loads of time over and over again, How can i read and write data better?

Appreciate any help or someone that could point me in the right direction.


while (true)
{

    if (client.Available > 0)
    {
        // RECEIVE FROM LOCAL
        l = client.Receive(lbuffer, 0, lbuffer.Length, 0);
        remote.Send(lbuffer, 0, l, 0);

        Console.WriteLine(l);

    }

    if (remote.Available > 0)
    {

        // RECEIVE FROM REMOTE
        r = remote.Receive(rbuffer, 0, rbuffer.Length, 0);
        client.Send(rbuffer, 0, r, 0);

        Console.WriteLine(r);
    }

}

Questionmulticolor DataGridView Pin
Assaf8228-Oct-07 3:19
Assaf8228-Oct-07 3:19 
AnswerRe: multicolor DataGridView Pin
Giorgi Dalakishvili28-Oct-07 3:50
mentorGiorgi Dalakishvili28-Oct-07 3:50 
GeneralRe: multicolor DataGridView Pin
Assaf8228-Oct-07 4:09
Assaf8228-Oct-07 4:09 
GeneralRe: multicolor DataGridView Pin
Giorgi Dalakishvili28-Oct-07 4:16
mentorGiorgi Dalakishvili28-Oct-07 4:16 
QuestionNamespace and Dataset! Pin
khalidelmeknesi28-Oct-07 3:10
khalidelmeknesi28-Oct-07 3:10 
AnswerRe: Namespace and Dataset! Pin
Paul Conrad28-Oct-07 6:35
professionalPaul Conrad28-Oct-07 6:35 
GeneralRe: Namespace and Dataset! Pin
khalidelmeknesi28-Oct-07 16:26
khalidelmeknesi28-Oct-07 16:26 
GeneralRe: Namespace and Dataset! Pin
Paul Conrad28-Oct-07 16:53
professionalPaul Conrad28-Oct-07 16:53 
QuestionLicensing in .NET Pin
danielk_28-Oct-07 2:33
danielk_28-Oct-07 2:33 
AnswerRe: Licensing in .NET Pin
Scott Dorman28-Oct-07 3:24
professionalScott Dorman28-Oct-07 3:24 
GeneralRe: Licensing in .NET Pin
jmcc2k24-Nov-10 17:37
jmcc2k24-Nov-10 17:37 
QuestionGraph Pin
babbelfisken28-Oct-07 2:05
babbelfisken28-Oct-07 2:05 
AnswerRe: Graph Pin
Robert Rohde28-Oct-07 2:10
Robert Rohde28-Oct-07 2:10 
QuestionArray as a buffer in multithreading Pin
szolDat28-Oct-07 1:37
szolDat28-Oct-07 1:37 
AnswerRe: Array as a buffer in multithreading Pin
Robert Rohde28-Oct-07 2:21
Robert Rohde28-Oct-07 2:21 
AnswerRe: Array as a buffer in multithreading Pin
Guffa28-Oct-07 3:37
Guffa28-Oct-07 3:37 
GeneralRe: Array as a buffer in multithreading Pin
szolDat28-Oct-07 7:53
szolDat28-Oct-07 7:53 

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.