Posted By:
gaurav_abbi
Posted On:
Friday, June 29, 2007 12:05 AM
hi all, i'm working on a issue in which when my http client recieves chunked response, it fails while writing the data in the internal process, i want to simulate it and for this i need to run a server which should respond with a chunked response so that i can see what's going wrong in my client part. i know how to bring up a simple server listening on a port which accepts a client request, but no clues about the above mentioned scenario please provide me some pointers for the above mentioned scenario, about what should i do, tht's what i'm doing currently, a simple server package serverClientFundas; import java.io.BufferedReader; import java.io.IOExce
More>>
hi all,
i'm working on a issue in which when my http client recieves chunked response, it fails while writing the data in the internal process, i want to simulate it and for this i need to run a server which should respond with a chunked response so that i can see what's going wrong in my client part.
i know how to bring up a simple server listening on a port which accepts a client request, but no clues about the above mentioned scenario
please provide me some pointers for the above mentioned scenario, about what should i do,
tht's what i'm doing currently, a simple server
package serverClientFundas;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class MyServer {
private static final int PORT_NUM = 43548;
public static void main(String[] args) {
ServerSocket serverSocket = null;
Socket clientSocket = null;
PrintWriter out = null;
BufferedReader in = null;
String str = null;
try{
serverSocket = new ServerSocket(PORT_NUM);
clientSocket = serverSocket.accept();
out = new PrintWriter(clientSocket.getOutputStream(),true);
in = new BufferedReader(new InputStreamReader (clientSocket.getInputStream()));
while((str = in.readLine()) != null && !str.equalsIgnoreCase("")){
System.out.println("got request from client: ["+str+"]");
out.println("response from server for input ["+str+"]");
}
}catch(IOException ioe){ System.err.println("server port not available: "+PORT_NUM); }finally{ try{ if(in != null) in.close(); if(out != null) out.close(); if(clientSocket != null) clientSocket.close(); if(serverSocket != null) serverSocket.close(); }catch(IOException ioe){ System.err.println("error while closing server resources: ["+ioe.getMessage()+"]"); } } }}
please tell me how to reply with a chunked te on top of this
<<Less