Click here to Skip to main content
15,891,316 members
Home / Discussions / C#
   

C#

 
AnswerRe: how make to quaver a window form? Pin
MoustafaS22-May-05 1:35
MoustafaS22-May-05 1:35 
GeneralRe: how make to quaver a window form? Pin
Sasuko22-May-05 2:07
Sasuko22-May-05 2:07 
GeneralCreate a textbox with background transparent Pin
Sasuko21-May-05 23:38
Sasuko21-May-05 23:38 
GeneralAn Ambitioous Console Replication Pin
amitmohanty21-May-05 18:16
amitmohanty21-May-05 18:16 
GeneralRe: An Ambitioous Console Replication Pin
Christian Graus22-May-05 16:08
protectorChristian Graus22-May-05 16:08 
GeneralRe: An Ambitioous Console Replication Pin
amitmohanty22-May-05 18:03
amitmohanty22-May-05 18:03 
GeneralRe: An Ambitioous Console Replication Pin
Christian Graus22-May-05 19:23
protectorChristian Graus22-May-05 19:23 
GeneralNetworkStream and TCPClient problem.. Please help Pin
jbergetun21-May-05 15:02
jbergetun21-May-05 15:02 
Can anyone help me with this problem, i am going blind looking at the code trying to figoure out whats wrong with it.

This is what I am trying to do ..
I have a small Form with a button, when the user clicks the button on the form, my program connects to a server and receive som information.
The server responds and sends back a couple of lines with text to my program, then my program prints out the info to the console. Simple enough rite ?


It actually works, or so it does the first time i click the button, but the second time i click the button my program decide only to print out the first line of what the server sent back to it.
First click on button: The program works 100% and prints out all the lines sendt from the server
Second click on the button: The program only prints out the first line of what the server sent back.

This is what i have in the button clickevent
NetworkStream myNetworkStream;

TcpClient tcpC = new TcpClient();
tcpC.Connect("home.bergetun.net",14000);
myNetworkStream = tcpC.GetStream();


string myCompleteMessage = "";
if(myNetworkStream.CanRead)
{
byte[] myReadBuffer = new byte[1024];

int numberOfBytesRead = 0;

do
{
numberOfBytesRead = myNetworkStream.Read(myReadBuffer, 0, myReadBuffer.Length);
myCompleteMessage =
String.Concat(myCompleteMessage, Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead));
}
while(myNetworkStream.DataAvailable);

Console.Out.WriteLine(myCompleteMessage);
}
myNetworkStream.Close();
tcpC.Close();

GeneralRe: NetworkStream and TCPClient problem.. Please help Pin
Marc Clifton21-May-05 15:18
mvaMarc Clifton21-May-05 15:18 
GeneralRe: NetworkStream and TCPClient problem.. Please help Pin
jbergetun22-May-05 0:38
jbergetun22-May-05 0:38 
GeneralRe: NetworkStream and TCPClient problem.. Please help Pin
Marc Clifton22-May-05 1:37
mvaMarc Clifton22-May-05 1:37 
GeneralCannot convert from stream to DirectX Audio Pin
Anthony Mushrow21-May-05 14:10
professionalAnthony Mushrow21-May-05 14:10 
GeneralC# Code to find the average of prime numbers between 1-100 Pin
diabolusgorgon21-May-05 14:06
diabolusgorgon21-May-05 14:06 
GeneralRe: C# Code to find the average of prime numbers between 1-100 Pin
diabolusgorgon21-May-05 15:03
diabolusgorgon21-May-05 15:03 
GeneralRe: C# Code to find the average of prime numbers between 1-100 Pin
Marc Clifton21-May-05 15:24
mvaMarc Clifton21-May-05 15:24 
GeneralRe: C# Code to find the average of prime numbers between 1-100 Pin
Robert Rohde21-May-05 20:43
Robert Rohde21-May-05 20:43 
GeneralNetworks questions Pin
felopater21-May-05 12:38
felopater21-May-05 12:38 
QuestionIs C# for engineers? Pin
amitmohanty21-May-05 12:32
amitmohanty21-May-05 12:32 
AnswerRe: Is C# for engineers? Pin
Colin Angus Mackay21-May-05 12:45
Colin Angus Mackay21-May-05 12:45 
GeneralRe: Is C# for engineers? Pin
amitmohanty21-May-05 13:13
amitmohanty21-May-05 13:13 
GeneralRe: Is C# for engineers? Pin
Colin Angus Mackay21-May-05 13:16
Colin Angus Mackay21-May-05 13:16 
GeneralRe: Is C# for engineers? Pin
amitmohanty21-May-05 13:30
amitmohanty21-May-05 13:30 
GeneralRe: Is C# for engineers? Pin
eggie521-May-05 14:39
eggie521-May-05 14:39 
GeneralRe: Is C# for engineers? Pin
amitmohanty21-May-05 14:44
amitmohanty21-May-05 14:44 
GeneralRe: Is C# for engineers? Pin
ekynox21-May-05 15:18
ekynox21-May-05 15:18 

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.