Click here to Skip to main content
15,919,500 members
Home / Discussions / C#
   

C#

 
Generaluint.Parse() vs. Convert.ToUint32() Pin
moredip12-Apr-03 14:48
moredip12-Apr-03 14:48 
GeneralRe: uint.Parse() vs. Convert.ToUint32() Pin
Stephane Rodriguez.12-Apr-03 21:10
Stephane Rodriguez.12-Apr-03 21:10 
GeneralRe: uint.Parse() vs. Convert.ToUint32() Pin
moredip13-Apr-03 0:38
moredip13-Apr-03 0:38 
GeneralRe: uint.Parse() vs. Convert.ToUint32() Pin
Stephane Rodriguez.13-Apr-03 1:15
Stephane Rodriguez.13-Apr-03 1:15 
GeneralRe: uint.Parse() vs. Convert.ToUint32() Pin
moredip13-Apr-03 1:23
moredip13-Apr-03 1:23 
GeneralRe: uint.Parse() vs. Convert.ToUint32() Pin
leppie13-Apr-03 3:00
leppie13-Apr-03 3:00 
GeneralRe: uint.Parse() vs. Convert.ToUint32() Pin
moredip13-Apr-03 3:01
moredip13-Apr-03 3:01 
GeneralTcpClient Problem Pin
Michal Januszczyk12-Apr-03 12:41
sussMichal Januszczyk12-Apr-03 12:41 
I have the following problem:

I use the folowing code on client side:

TcpClient client =...
byte[] buffer = new byte[MaxSize];
while(...)
{
networkStream ns = client.getNetworkStream();
readCount = ns.Read(buffer,0,MaxSize)
}

The loop is run on a separate thread, and it is deliberately
run forever. If the TcpClient really has something to
get from server, it really reads it (most probably from
intermediate buffers filled by lower level mechanisms)

And now description of the problem:
When I use this loop for the first time all works fine.
I mean that the complete first Read routine works fine.
(e.g when I want to get 500 KB data from socket, it is
partially fetched in chunks)

When the communication is over, the remote server closes
both stream and TcpClient:

SubsequentClient.Close();
SubsequentClientNS.Close();

In this moment I think, that the client code should
encouter some exception, but nothing is thrown... (?)Unsure | :~

The things get worse when i want to use the loop again
and pool the TcpClient (which should me marked invalid now)
whether somethig has arrived =>
i call again Read method, and instad of some error/exception
i just get 0 (no data has been read) (this means, that the server
has not sent any data to client yet)

The question is:
How to make the client code know when the server has really closed
it's network stream (which it uses to send data to the client)
and/or closed TcpClient (which it obtained via Accept() method)


Thanx for any sugestions

GeneralRe: TcpClient Problem Pin
Stephane Rodriguez.12-Apr-03 21:24
Stephane Rodriguez.12-Apr-03 21:24 
GeneralRe: TcpClient Problem Pin
Michal Januszczyk13-Apr-03 11:06
sussMichal Januszczyk13-Apr-03 11:06 
GeneralCharacter Codes Pin
J. Dunlap12-Apr-03 10:52
J. Dunlap12-Apr-03 10:52 
GeneralRe: Character Codes Pin
Stephane Rodriguez.12-Apr-03 21:08
Stephane Rodriguez.12-Apr-03 21:08 
Generalreading double encoded by php pack() problem Pin
Member 28242012-Apr-03 10:42
Member 28242012-Apr-03 10:42 
GeneralRe: reading double encoded by php pack() problem Pin
Stephane Rodriguez.12-Apr-03 20:56
Stephane Rodriguez.12-Apr-03 20:56 
GeneralExtended File Properties Pin
Querulant12-Apr-03 8:55
Querulant12-Apr-03 8:55 
GeneralRe: Extended File Properties Pin
Stephane Rodriguez.12-Apr-03 20:50
Stephane Rodriguez.12-Apr-03 20:50 
GeneralThanks Pin
Querulant13-Apr-03 3:44
Querulant13-Apr-03 3:44 
GeneralUsing windows api in C# Pin
rm_babar12-Apr-03 6:40
rm_babar12-Apr-03 6:40 
GeneralRe: Using windows api in C# Pin
Stephane Rodriguez.12-Apr-03 20:46
Stephane Rodriguez.12-Apr-03 20:46 
GeneralRe: Using windows api in C# Pin
James T. Johnson13-Apr-03 5:28
James T. Johnson13-Apr-03 5:28 
GeneralQuestion about Web Services Pin
Zibar12-Apr-03 4:58
sussZibar12-Apr-03 4:58 
GeneralRe: Question about Web Services Pin
Stephane Rodriguez.12-Apr-03 6:30
Stephane Rodriguez.12-Apr-03 6:30 
GeneralRe: Question about Web Services Pin
Cristoff13-Apr-03 0:43
Cristoff13-Apr-03 0:43 
GeneralRe: Question about Web Services Pin
Cristoff13-Apr-03 0:45
Cristoff13-Apr-03 0:45 
QuestionHow to use and custom MS Internet Explore? Pin
Small Rat12-Apr-03 4:28
Small Rat12-Apr-03 4:28 

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.