Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Socket Problem

Status
Not open for further replies.

Pro79

Programmer
Dec 11, 2003
24
IN
hi to All,
I am facing some problem regarding the socket programming in java .
I made a connection to a printer through the socket and i am sending some request to the printer it`s work fine
The socket is keep a live infinite time

I am storing the sockets in hashmap , as i have connected more than printer to the system .

Now the problem is thats if some body switch off of the printer then again on the printer , my socket doesn`t seems to be working . As it was using the old socket

Can any body tell is there a way to check whether a socket is disconnected (means if some body switch off the printer)

Looking for the good reply !!!!!!!!!!!!!
 
Have you ever tried using the javadoc or manual for Java ?


If you had consulted this, then you would see that there are five methods of interest :

isBound()
isClosed()
isConnected()
isOutputShutdown()
isInputShutdown()

In any case, should you not be creating a new socket each time someone wants to print something, rather than keeping an open TCP/IP Socket open ?



--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top