This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes --Sockets in Servlets/JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "--Sockets in Servlets/JSP" Watch "--Sockets in Servlets/JSP" New topic
Author

--Sockets in Servlets/JSP

Thomas Dev
Greenhorn

Joined: Dec 15, 2003
Posts: 4
Can we do Socket Programming in Servlets or JSP?
OR can we call a class from Servlets/JSP that does
socket connection.
I have a class that does a socket connection and then
closes the socket when processing is done.
When I try to instantiate this class from JSP I get a
IllegalStateException: Response has already been commited
error.
Why am I getting this error? I havent even called any method
I get this error just by instantiating the class.
If I comment the socket part from the class then it works fine.
regards
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
Originally posted by Thomas Dev:
Can we do Socket Programming in Servlets or JSP?
OR can we call a class from Servlets/JSP that does
socket connection.
I have a class that does a socket connection and then
closes the socket when processing is done.
When I try to instantiate this class from JSP I get a
IllegalStateException: Response has already been commited
error.
Why am I getting this error? I havent even called any method
I get this error just by instantiating the class.
If I comment the socket part from the class then it works fine.
regards

Try to do the same in Servlet.
In jsp you dont know when its sending response. Try to see generated java file.


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
 
 
subject: --Sockets in Servlets/JSP
 
Similar Threads
Reg: java.net.SocketException....
MIDP and Connection Not Found Exception:
Socket Connection Not Working With Java Desktop Application
Sockets in Servlets/JSP
Connection reset by peer: socket write error