Software caused connection abort: socket write error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kuguy
    New Member
    • Mar 2008
    • 2

    #1

    Software caused connection abort: socket write error

    Hi all,

    I'm new to the forums, so I hope this isn't in the wrong place...

    I have that "Software caused connection abort: socket write error" exception error that i've never meet before.

    Basically what im trying to do is the following:
    - a client connect to a server using sslsocket.
    - server receive the connection and reply with the first part of the data and keep the connection open.
    - then client receive the reply and request for another data using the same socket connection
    - then server receive the next request and reply with the second part of the data and close the connection when the loop is finish.

    what im trying to do is actually to chunk the download size. consider I need to download a 20MB of data from the server, using a single request is fine, but client have to wait for sometime until all the data is downloaded. so im trying to chunk the data into several part, and the server will send the chunk of data one by one. so the moment client receive the first part of the data, it will display it directly and at the same time will process the next data.

    creating a new socket request for each chunk of data will be slow since it has to keep open and close the socket to server several times.

    so in short, im trying to utilize one socket connection to do several data communication between client and server.
    can you help point out what i did wrong in doing this..? or a link to any site providing example in doing this..?

    Thanking you in advance for your help and sorry for the length of the post.. :)


    //server side
    GZIPOutputStrea m gos = new GZIPOutputStrea m(child.getOutp utStream());
    GZIPInputStream gis = new GZIPInputStream (child.getInput Stream());
    ObjectOutputStr eam out = new ObjectOutputStr eam(new BufferedOutputS tream(gos,48000 ));
    ObjectInputStre am in = new ObjectInputStre am(new BufferedInputSt ream(gis,48000) );

    out.writeObject ( passRequest( obj ) );
    out.flush();
    gos.finish();
    String sDate, eDate;

    do{
    gis = new GZIPInputStream (child.getInput Stream());
    in = new ObjectInputStre am(new BufferedInputSt ream(gis,48000) );
    obj=in.readObje ct();

    Vector<String> dates = (Vector<String> ) ((CRequest) obj)
    .getInfo();
    String start = dates.get(0);
    String end = dates.get(1);
    SimpleDateForma t sdf = new SimpleDateForma t(
    "MMM dd, yyyy hh:mm:ss a");
    SimpleDateForma t sdf3 = new SimpleDateForma t(
    "yyyy-MM-dd HH:mm:ss");

    Date startD = null;
    Date endD = null;

    try {
    startD = sdf.parse(start );
    endD = sdf.parse(end);
    } catch (ParseException e1) {

    e1.printStackTr ace();
    }
    sDate = sdf3.format(sta rtD);
    eDate = sdf3.format(end D);
    gos = new GZIPOutputStrea m(child.getOutp utStream());
    out = new ObjectOutputStr eam(new BufferedOutputS tream(gos,48000 ));
    out.writeObject ( passRequest( obj ) );
    out.flush();
    gos.finish();

    }while(!sDate.e quals(eDate));



    //client side

    sslFact = (SSLSocketFacto ry) SSLSocketFactor y
    .getDefault();
    server = (SSLSocket) sslFact.createS ocket(ip, port);
    server.setEnabl edCipherSuites( set);
    server.setRecei veBufferSize(48 000);
    server.setSendB ufferSize(48000 );

    Date currentEnd = GlobalMethods.s Date;
    Date currentStart;
    long period = 1000*60*60*6; //6 hours
    long endTime = GlobalMethods.e Date.getTime();

    //request splitted historical time until end date is reached
    //if currentStart and currentEnd are equals, so it's the last request
    while(currentEn d.getTime() < endTime){

    currentStart = currentEnd;
    long nextPeriod = currentStart.ge tTime() + period;
    if(nextPeriod < endTime)
    currentEnd = new Date(nextPeriod );
    else
    currentEnd = new Date(endTime);

    dates.clear();
    dates.add(curre ntStart.toLocal eString());
    dates.add(curre ntEnd.toLocaleS tring());

    creq = new CRequest(Activa tor.cookie,
    RequestConstant s.CMC_REQUEST_D ATA, segment, dates,
    ip, port);
    gos = new GZIPOutputStrea m(server.getOut putStream());
    out = new ObjectOutputStr eam(new BufferedOutputS tream(gos, 48000));
    // /* Can we actually send ourselves and then receive ourselves?*/
    out.writeObject (creq);
    out.flush();
    gos.finish();
    gis = new GZIPInputStream (server.getInpu tStream());
    in = new ObjectInputStre am(new BufferedInputSt ream(gis, 48000));
    /* Returning the newly modified request with results */
    final CRequest received = (CRequest) in.readObject() ;

    PlatformUI.getW orkbench().getD isplay().asyncE xec(
    new Runnable() {
    public void run() {
    pref.processDat a((GeneralDataO bj) received
    .getInfo());
    }
    });
    }




    //server log error :

    javax.net.ssl.S SLException: Connection has been shutdown: javax.net.ssl.S SLException:

    java.net.Socket Exception: Software caused connection abort: socket write error
    at com.sun.net.ssl .internal.ssl.S SLSocketImpl.ch eckEOF(Unknown Source)
    at com.sun.net.ssl .internal.ssl.S SLSocketImpl.ch eckWrite(Unknow n Source)
    at com.sun.net.ssl .internal.ssl.A ppOutputStream. write(Unknown Source)
    at java.util.zip.D eflaterOutputSt ream.deflate(Un known Source)
    at java.util.zip.D eflaterOutputSt ream.write(Unkn own Source)
    at java.util.zip.G ZIPOutputStream .write(Unknown Source)
    at java.io.Buffere dOutputStream.f lushBuffer(Unkn own Source)
    at java.io.Buffere dOutputStream.w rite(Unknown Source)
    at java.io.ObjectO utputStream$Blo ckDataOutputStr eam.drain(Unkno wn Source)
    at java.io.ObjectO utputStream$Blo ckDataOutputStr eam.setBlockDat aMode(Unknown

    Source)
    at java.io.ObjectO utputStream.wri teNonProxyDesc( Unknown Source)
    at java.io.ObjectO utputStream.wri teClassDesc(Unk nown Source)
    at java.io.ObjectO utputStream.wri teOrdinaryObjec t(Unknown Source)
    at java.io.ObjectO utputStream.wri teObject0(Unkno wn Source)
    at java.io.ObjectO utputStream.wri teFatalExceptio n(Unknown Source)
    at java.io.ObjectO utputStream.wri teObject(Unknow n Source)
    at com.inetmon.jn. server.SessionM anager.run(Sess ionManager.java :153)
    Caused by: javax.net.ssl.S SLException: java.net.Socket Exception: Software caused

    connection abort: socket write error
    at com.sun.net.ssl .internal.ssl.A lerts.getSSLExc eption(Unknown Source)
    at com.sun.net.ssl .internal.ssl.S SLSocketImpl.fa tal(Unknown Source)
    at com.sun.net.ssl .internal.ssl.S SLSocketImpl.fa tal(Unknown Source)
    at com.sun.net.ssl .internal.ssl.S SLSocketImpl.ha ndleException(U nknown Source)
    at com.sun.net.ssl .internal.ssl.S SLSocketImpl.ha ndleException(U nknown Source)
    at com.sun.net.ssl .internal.ssl.A ppOutputStream. write(Unknown Source)
    at java.util.zip.D eflaterOutputSt ream.deflate(Un known Source)
    at java.util.zip.D eflaterOutputSt ream.write(Unkn own Source)
    at java.util.zip.G ZIPOutputStream .write(Unknown Source)
    at java.io.Buffere dOutputStream.f lushBuffer(Unkn own Source)
    at java.io.Buffere dOutputStream.w rite(Unknown Source)
    at java.io.ObjectO utputStream$Blo ckDataOutputStr eam.drain(Unkno wn Source)
    at java.io.ObjectO utputStream$Blo ckDataOutputStr eam.write(Unkno wn Source)
    at java.io.ObjectO utputStream.def aultWriteFields (Unknown Source)
    at java.io.ObjectO utputStream.wri teSerialData(Un known Source)
    at java.io.ObjectO utputStream.wri teOrdinaryObjec t(Unknown Source)
    at java.io.ObjectO utputStream.wri teObject0(Unkno wn Source)
    at java.io.ObjectO utputStream.wri teArray(Unknown Source)
    at java.io.ObjectO utputStream.wri teObject0(Unkno wn Source)
    at java.io.ObjectO utputStream.def aultWriteFields (Unknown Source)
    at java.io.ObjectO utputStream.def aultWriteObject (Unknown Source)
    at java.util.Vecto r.writeObject(U nknown Source)
    at sun.reflect.Gen eratedMethodAcc essor1.invoke(U nknown Source)
    at sun.reflect.Del egatingMethodAc cessorImpl.invo ke(Unknown Source)
    at java.lang.refle ct.Method.invok e(Unknown Source)
    at java.io.ObjectS treamClass.invo keWriteObject(U nknown Source)
    at java.io.ObjectO utputStream.wri teSerialData(Un known Source)
    at java.io.ObjectO utputStream.wri teOrdinaryObjec t(Unknown Source)
    at java.io.ObjectO utputStream.wri teObject0(Unkno wn Source)
    at java.io.ObjectO utputStream.def aultWriteFields (Unknown Source)
    at java.io.ObjectO utputStream.wri teSerialData(Un known Source)
    at java.io.ObjectO utputStream.wri teOrdinaryObjec t(Unknown Source)
    at java.io.ObjectO utputStream.wri teObject0(Unkno wn Source)
    at java.io.ObjectO utputStream.def aultWriteFields (Unknown Source)
    at java.io.ObjectO utputStream.wri teSerialData(Un known Source)
    at java.io.ObjectO utputStream.wri teOrdinaryObjec t(Unknown Source)
    at java.io.ObjectO utputStream.wri teObject0(Unkno wn Source)
    ... 2 more
    Caused by: java.net.Socket Exception: Software caused connection abort: socket write error
    at java.net.Socket OutputStream.so cketWrite0(Nati ve Method)
    at java.net.Socket OutputStream.so cketWrite(Unkno wn Source)
    at java.net.Socket OutputStream.wr ite(Unknown Source)
    at com.sun.net.ssl .internal.ssl.O utputRecord.wri teBuffer(Unknow n Source)
    at com.sun.net.ssl .internal.ssl.O utputRecord.wri te(Unknown Source)
    at com.sun.net.ssl .internal.ssl.S SLSocketImpl.wr iteRecord(Unkno wn Source)
    ... 34 more
Working...