-
Probably a silly question
In java how do I tell if a socket was disconnected?
In C++/C# I can just poll the socket to get its status...
But how do I do that in Java? I thought the getInputStream would throw an
exception but it doesn't. and it just shows 0 bytes available. But if the
client closes, how is the server supposed to know? Seems like a silly question....
probably trivial, but would make my life easier.
-
Re: Probably a silly question
"GJ" <star_screamer@hotmail.com> wrote:
>
>In java how do I tell if a socket was disconnected?
>In C++/C# I can just poll the socket to get its status...
>
>But how do I do that in Java? I thought the getInputStream would throw an
>exception but it doesn't. and it just shows 0 bytes available. But if the
>client closes, how is the server supposed to know? Seems like a silly question....
>probably trivial, but would make my life easier.
"isClosed"
public boolean isClosed()
Returns the closed state of the socket
Returns:
true if the socket has been closed
Since:
1.4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks