D
djc
I read a network programming book (based on framework 1.1) which indicated
that you should 'never' use the RecieveTimeout or the SendTimeout 'socket
options' on TCP sockets or you may loose data. I now see the
socket.RecieveTimeout 'property' in the visual studio 2005 help
documentation (framework 2.0) and it has example of it being used with TCP
socket. This propery is also listed as 'new in .net 2.0'.
1) is the socket.RecieveTimeout property just a 'new' property that exposes
the existing RecieveTimeout socket option? meaning, are they essentially the
same thing?
2) should it be used with TCP sockets?
3) I'm looking for a stable way, following good programming practices, to
structure my client-server send/receive operations (all synchronous at this
point - no real volume). The example from the book I read doesn't seem to
cover the client side handling the case of a server side issue. To clarify
that, the book generally says this:
in english, to send data and then receive response: connect to remote host,
send data, call socket.shutdown, enter an infinite loop which calls recieve
and checks the number of bytes recieved. When the bytes recieved == 0 you
break out of the loop and then call socket.close.
my question is that what if there is a problem on the server end and the
bytes recieved NEVER == 0? Logically I am thinking I would use the
socket.RecieveTimeout as a contingency plan but the book advises against it?
So what do you do? Similarly, I need solution for send operations. If you
are not supposed to use the SendTimeout then what do you do to bail out of a
problem?
any input on this would be greatly appreciated. Thanks.
that you should 'never' use the RecieveTimeout or the SendTimeout 'socket
options' on TCP sockets or you may loose data. I now see the
socket.RecieveTimeout 'property' in the visual studio 2005 help
documentation (framework 2.0) and it has example of it being used with TCP
socket. This propery is also listed as 'new in .net 2.0'.
1) is the socket.RecieveTimeout property just a 'new' property that exposes
the existing RecieveTimeout socket option? meaning, are they essentially the
same thing?
2) should it be used with TCP sockets?
3) I'm looking for a stable way, following good programming practices, to
structure my client-server send/receive operations (all synchronous at this
point - no real volume). The example from the book I read doesn't seem to
cover the client side handling the case of a server side issue. To clarify
that, the book generally says this:
in english, to send data and then receive response: connect to remote host,
send data, call socket.shutdown, enter an infinite loop which calls recieve
and checks the number of bytes recieved. When the bytes recieved == 0 you
break out of the loop and then call socket.close.
my question is that what if there is a problem on the server end and the
bytes recieved NEVER == 0? Logically I am thinking I would use the
socket.RecieveTimeout as a contingency plan but the book advises against it?
So what do you do? Similarly, I need solution for send operations. If you
are not supposed to use the SendTimeout then what do you do to bail out of a
problem?
any input on this would be greatly appreciated. Thanks.