I have made a client server app in VB.Net. I used Tcpistener in server app and TcpClient in client app. My server supports multiple clients. There is a separate thread for each client that connets to the server so they can exchange msgs. The problem i m facing is that when i close the Client app the client socket on the server side dose not close. I ckeched it by retreiving the protected property of TcpClient 'Client' to check whether the scoket is connected or not. Its 'Connected' property returns true that means the client socket is alive. Due to this problem i can not close/exit the respective client thread
please help.
=?Utf-8?B?R2hhemFuZmVy?= <anonymous@discussions.microsoft.com> wrote in
news:86324324-0E58-4529-9B85-158BEA77BC35@microsoft.com:
> ckeched it by retreiving the protected property of TcpClient 'Client' to
> check whether the scoket is connected or not. Its 'Connected' property
> returns true that means the client socket is alive. Due to this problem
> i can not close/exit the respective client thread.
You misunderstand how sockets work. The Connect property can only "update"
itself during reads and writes. So if you disconnect but then dont read or
write, it cannot know this. This is why most protocols when they disconnect
agree to disconnect first.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Hi,
At this time, dotNet mainly supports blocking socket. dotNet has very
little support to non-blocking socket and forgets all of socket
communication events such as OnClose, OnAccept, OnDataArrive, OnWrite,
OnConnect etc. You must fight your problems by sending data periodically for
detecting network connection. It is truly ugly, but you have no other
choice. Our SocketPro implements these events. For details, see the VB
samples inside the package SocketPro at www.udaparts.com

Signature
Yuancai (Charlie) Ye
Fast and securely accessing all of remote data sources anywhere with
SocketPro using batch/queue, asynchrony and parallel computation
See 30 well-tested and real OLEDB examples
RDB, a tool for fast and securely accessing remote databases with dial-up,
cable, DSL and wireless modems anywhere
www.udaparts.com
> I have made a client server app in VB.Net. I used Tcpistener in server app and TcpClient in client app. My server supports multiple clients. There is a
separate thread for each client that connets to the server so they can
exchange msgs. The problem i m facing is that when i close the Client app
the client socket on the server side dose not close. I ckeched it by
retreiving the protected property of TcpClient 'Client' to check whether the
scoket is connected or not. Its 'Connected' property returns true that
means the client socket is alive. Due to this problem i can not close/exit
the respective client thread.
> please help.
Feroze [MSFT] - 24 May 2004 23:55 GMT
Can you give more information on why you think "dotnet has very little
support on non-blockiing socket" ?
System.Net.Sockets.Socket class supports asynchronous usage. If there are
particular issues that you found, I would be happy to hear about them.
As regards events: yes, Sockets doesnt support events, although we are
working to rectify this in a future version.
THanks.

Signature
feroze
http://weblogs.asp.net/feroze_daud
============
Remove "user" from the email address to reply to the author.
This posting is provided "AS IS" with no warranties, and confers no rights
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
> Hi,
> At this time, dotNet mainly supports blocking socket. dotNet has very
[quoted text clipped - 16 lines]
> >
> > please help.
Yuancai \(Charlie\) Ye - 26 May 2004 17:29 GMT
Hi,
These events are extremely important for developing a full non-blocking
socket application. Dotnet socket implementation is poor in comparison to
native window system socket 2 APIs. System.Net.Sockets.Socket class supports
asynchronous usage through dotnet interface IAsyncResult with creating extra
threads. Native window system socket 2 APIs do not require extra threads at
all, which avoids all of thread side effects such as dead lock and data
synchronization etc.

Signature
Yuancai (Charlie) Ye
Fast and securely accessing all of remote data sources anywhere with
SocketPro using batch/queue, asynchrony and parallel computation with online
compressing
See 30 well-tested and real OLEDB examples
www.udaparts.com
> Can you give more information on why you think "dotnet has very little
> support on non-blockiing socket" ?
[quoted text clipped - 30 lines]
> > >
> > > please help.
feroze [msft] - 01 Jul 2004 07:42 GMT
I dont disagree with you that Eventing model is important for a good
developer experience, esp for the begining developer. However, eventing is
not the be-all and end-all of writing a non-blocking application.
I disagree with your assertion that System.Net.Sockets implementation is
poor in comparison to native winsock2 apis. The Sockets classes are based on
tthe winsock2 apis. On WindowsNT platforms, we use I/O completionports to
give you the best performance. On Win9x platforms, Overlapped I/O is used.
In this case you might see an extra thread.
On NT, there is no extra thread created when you use async i/o.
feroze
=====================================
> Hi,
> These events are extremely important for developing a full non-blocking
[quoted text clipped - 47 lines]
> > > >
> > > > please help.