Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 24th, 2003, 03:20 AM
Authorized User
Join Date: Jun 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can be created a Socket client in a Servlet?

I am trying to create in a Servlet a Shocket client.
The client makes a request, I must itself connect to a machine, to a concrete port, to pass a String to him and to gather the String that she gives me like answer.
I always obtain an error:
       Software caused connection abort: recv failed
It is had to create a thread by Socket obligatorily?
This my code:
      DataOutputStream os = null;
      DataInputStream is = null;
         if(clientSocket == null) {
            clientSocket = new Socket(host, port);
         is = new DataInputStream(clientSocket.getInputStream());
         os = new DataOutputStream(clientSocket.getOutputStream());
         String response = is.readLine();

      catch(Exception e) {
           System.out.println("ERROR: "+e.getMessage()+"--> "+e);

Similar Threads
Thread Thread Starter Forum Replies Last Post
connecting client to client (Socket programming) maricar C# 0 September 25th, 2008 04:34 AM
Socket Programming lisamargaret C# 1 December 18th, 2007 10:20 AM
Send file from Servlet to Client End (Swing) nigam.anand Servlets 0 April 22nd, 2006 02:22 AM
sending a file from swing client to servlet sid_ Servlets 0 March 2nd, 2005 05:18 PM
connecting a Swing client to an existing servlet a jcarlier Java GUI 1 June 17th, 2004 05:33 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.