You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Neeraja Divakaruni <ne...@oracle.com> on 2002/06/11 14:05:21 UTC

java.net.SocketException: socket write error (code=10053) on apache

Hi,

we have the following code in our application and it fails with
"java.net.SocketException: socket write error (code=10053)"  error when DATA
STRING which is the data to be written onto the socket exceeds 20 MB (to be
generic with large amounts of data)


socket = getConn(url.getHost(), url.getPort());

StringReader stringreader = new StringReader(DATA STRING);
OutputStreamWriter outputstreamwriter = new
OutputStreamWriter(socket.getOutputStream());
int i = 0;
int j = SystemProperties.SIZE_READBUF;
char ac[] = new char[j];
int k;
while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
{
outputstreamwriter.write(ac, 0, k);
outputstreamwriter.flush();
i += k;
}

How ever if we establish the socket connection after reading the data into
the StringReader i.e with the following modification it works.


StringReader stringreader = new StringReader(DATA STRING);
socket = getConn(url.getHost(), url.getPort());
OutputStreamWriter outputstreamwriter = new
OutputStreamWriter(socket.getOutputStream());
int i = 0;
int j = SystemProperties.SIZE_READBUF;
char ac[] = new char[j];
int k;
while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
{
outputstreamwriter.write(ac, 0, k);
outputstreamwriter.flush();
i += k;
}

What can be the reason for this. .Is it the limitation with apache or it is
some version related.Is there any way we can avoid this using some methods.
can any of you help me in identifying the issue.

Thanks
Neeraja

Re: java.net.SocketException: socket write error (code=10053)onapache

Posted by Lee Fellows <lf...@4lane.com>.
Hi Neeraja,

  Good question.  I doubt it, though.  My original thought was a buggy
JVM or conflict between classes you may be importing.

  The original error you reported implies the other end had shutdown the
socket it was listening on.  Without knowing the implementation of
both ends, its difficult to be more specific.  That moving the point
of initialization of your socket in the sample code changed the behavior
seems to point to a buggy jvm implementation.  But I do not know what
controls m_run, and whether those conditions, rather than the socket
initialization, played a role in the behaviour you saw.



On Tue, 2002-06-11 at 12:03, Neeraja wrote:
> Can you give me any ideas on what could be the reason for this behaviour.I also feel
> that it should not be apache.
> Is this behaviour occurs because of some socket timeouts etc.
> 
> 
> 
> Lee Fellows wrote:
> 
> > I am glad it works, but still puzzled how Apache is involved.  As to the
> > 'way' Apache handles output streams, as relates to your program, it does
> > not. Your code opens, closes, and in all ways controls any stream it
> > uses.  Apache plays no part in it.
> >
> > On Tue, 2002-06-11 at 09:07, Neeraja Divakaruni wrote:
> > > I tried this with client and server. My concern is whether this error anyway
> > > related to the way Apache handles the output streams.
> > > because I saw in one site that socket outputstream it indirectly calls a
> > > JservOutputStream class to handle this part.
> > > So am  wondering if this anyway related to Apache. But the code change made made
> > > a  difference.
> > > Thanks
> > > Neeraja
> > >
> > > Lee Fellows wrote:
> > >
> > > > Have you tried writing the server and client(?) as seperate applications
> > > > and tested their functionality?  I don't see how the 'change' you list
> > > > would effect anything, but I have not dug into the specs.  As to its
> > > > relevence to Apache, how is this in any manner connected to Apache?
> > > >
> > > > On Tue, 2002-06-11 at 08:05, Neeraja Divakaruni wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > we have the following code in our application and it fails with
> > > > > "java.net.SocketException: socket write error (code=10053)"  error when DATA
> > > > > STRING which is the data to be written onto the socket exceeds 20 MB (to be
> > > > > generic with large amounts of data)
> > > > >
> > > > >
> > > > > socket = getConn(url.getHost(), url.getPort());
> > > > >
> > > > > StringReader stringreader = new StringReader(DATA STRING);
> > > > > OutputStreamWriter outputstreamwriter = new
> > > > > OutputStreamWriter(socket.getOutputStream());
> > > > > int i = 0;
> > > > > int j = SystemProperties.SIZE_READBUF;
> > > > > char ac[] = new char[j];
> > > > > int k;
> > > > > while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> > > > > {
> > > > > outputstreamwriter.write(ac, 0, k);
> > > > > outputstreamwriter.flush();
> > > > > i += k;
> > > > > }
> > > > >
> > > > > How ever if we establish the socket connection after reading the data into
> > > > > the StringReader i.e with the following modification it works.
> > > > >
> > > > >
> > > > > StringReader stringreader = new StringReader(DATA STRING);
> > > > > socket = getConn(url.getHost(), url.getPort());
> > > > > OutputStreamWriter outputstreamwriter = new
> > > > > OutputStreamWriter(socket.getOutputStream());
> > > > > int i = 0;
> > > > > int j = SystemProperties.SIZE_READBUF;
> > > > > char ac[] = new char[j];
> > > > > int k;
> > > > > while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> > > > > {
> > > > > outputstreamwriter.write(ac, 0, k);
> > > > > outputstreamwriter.flush();
> > > > > i += k;
> > > > > }
> > > > >
> > > > > What can be the reason for this. .Is it the limitation with apache or it is
> > > > > some version related.Is there any way we can avoid this using some methods.
> > > > > can any of you help me in identifying the issue.
> > > > >
> > > > > Thanks
> > > > > Neeraja
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > > For additional commands, e-mail: users-help@httpd.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: java.net.SocketException: socket write error (code=10053)onapache

Posted by Neeraja <ne...@oracle.com>.
Can you give me any ideas on what could be the reason for this behaviour.I also feel
that it should not be apache.
Is this behaviour occurs because of some socket timeouts etc.



Lee Fellows wrote:

> I am glad it works, but still puzzled how Apache is involved.  As to the
> 'way' Apache handles output streams, as relates to your program, it does
> not. Your code opens, closes, and in all ways controls any stream it
> uses.  Apache plays no part in it.
>
> On Tue, 2002-06-11 at 09:07, Neeraja Divakaruni wrote:
> > I tried this with client and server. My concern is whether this error anyway
> > related to the way Apache handles the output streams.
> > because I saw in one site that socket outputstream it indirectly calls a
> > JservOutputStream class to handle this part.
> > So am  wondering if this anyway related to Apache. But the code change made made
> > a  difference.
> > Thanks
> > Neeraja
> >
> > Lee Fellows wrote:
> >
> > > Have you tried writing the server and client(?) as seperate applications
> > > and tested their functionality?  I don't see how the 'change' you list
> > > would effect anything, but I have not dug into the specs.  As to its
> > > relevence to Apache, how is this in any manner connected to Apache?
> > >
> > > On Tue, 2002-06-11 at 08:05, Neeraja Divakaruni wrote:
> > > >
> > > > Hi,
> > > >
> > > > we have the following code in our application and it fails with
> > > > "java.net.SocketException: socket write error (code=10053)"  error when DATA
> > > > STRING which is the data to be written onto the socket exceeds 20 MB (to be
> > > > generic with large amounts of data)
> > > >
> > > >
> > > > socket = getConn(url.getHost(), url.getPort());
> > > >
> > > > StringReader stringreader = new StringReader(DATA STRING);
> > > > OutputStreamWriter outputstreamwriter = new
> > > > OutputStreamWriter(socket.getOutputStream());
> > > > int i = 0;
> > > > int j = SystemProperties.SIZE_READBUF;
> > > > char ac[] = new char[j];
> > > > int k;
> > > > while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> > > > {
> > > > outputstreamwriter.write(ac, 0, k);
> > > > outputstreamwriter.flush();
> > > > i += k;
> > > > }
> > > >
> > > > How ever if we establish the socket connection after reading the data into
> > > > the StringReader i.e with the following modification it works.
> > > >
> > > >
> > > > StringReader stringreader = new StringReader(DATA STRING);
> > > > socket = getConn(url.getHost(), url.getPort());
> > > > OutputStreamWriter outputstreamwriter = new
> > > > OutputStreamWriter(socket.getOutputStream());
> > > > int i = 0;
> > > > int j = SystemProperties.SIZE_READBUF;
> > > > char ac[] = new char[j];
> > > > int k;
> > > > while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> > > > {
> > > > outputstreamwriter.write(ac, 0, k);
> > > > outputstreamwriter.flush();
> > > > i += k;
> > > > }
> > > >
> > > > What can be the reason for this. .Is it the limitation with apache or it is
> > > > some version related.Is there any way we can avoid this using some methods.
> > > > can any of you help me in identifying the issue.
> > > >
> > > > Thanks
> > > > Neeraja
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: java.net.SocketException: socket write error (code=10053) onapache

Posted by Lee Fellows <lf...@4lane.com>.
I am glad it works, but still puzzled how Apache is involved.  As to the
'way' Apache handles output streams, as relates to your program, it does
not. Your code opens, closes, and in all ways controls any stream it
uses.  Apache plays no part in it.


On Tue, 2002-06-11 at 09:07, Neeraja Divakaruni wrote:
> I tried this with client and server. My concern is whether this error anyway
> related to the way Apache handles the output streams.
> because I saw in one site that socket outputstream it indirectly calls a
> JservOutputStream class to handle this part.
> So am  wondering if this anyway related to Apache. But the code change made made
> a  difference.
> Thanks
> Neeraja
> 
> Lee Fellows wrote:
> 
> > Have you tried writing the server and client(?) as seperate applications
> > and tested their functionality?  I don't see how the 'change' you list
> > would effect anything, but I have not dug into the specs.  As to its
> > relevence to Apache, how is this in any manner connected to Apache?
> >
> > On Tue, 2002-06-11 at 08:05, Neeraja Divakaruni wrote:
> > >
> > > Hi,
> > >
> > > we have the following code in our application and it fails with
> > > "java.net.SocketException: socket write error (code=10053)"  error when DATA
> > > STRING which is the data to be written onto the socket exceeds 20 MB (to be
> > > generic with large amounts of data)
> > >
> > >
> > > socket = getConn(url.getHost(), url.getPort());
> > >
> > > StringReader stringreader = new StringReader(DATA STRING);
> > > OutputStreamWriter outputstreamwriter = new
> > > OutputStreamWriter(socket.getOutputStream());
> > > int i = 0;
> > > int j = SystemProperties.SIZE_READBUF;
> > > char ac[] = new char[j];
> > > int k;
> > > while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> > > {
> > > outputstreamwriter.write(ac, 0, k);
> > > outputstreamwriter.flush();
> > > i += k;
> > > }
> > >
> > > How ever if we establish the socket connection after reading the data into
> > > the StringReader i.e with the following modification it works.
> > >
> > >
> > > StringReader stringreader = new StringReader(DATA STRING);
> > > socket = getConn(url.getHost(), url.getPort());
> > > OutputStreamWriter outputstreamwriter = new
> > > OutputStreamWriter(socket.getOutputStream());
> > > int i = 0;
> > > int j = SystemProperties.SIZE_READBUF;
> > > char ac[] = new char[j];
> > > int k;
> > > while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> > > {
> > > outputstreamwriter.write(ac, 0, k);
> > > outputstreamwriter.flush();
> > > i += k;
> > > }
> > >
> > > What can be the reason for this. .Is it the limitation with apache or it is
> > > some version related.Is there any way we can avoid this using some methods.
> > > can any of you help me in identifying the issue.
> > >
> > > Thanks
> > > Neeraja
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: java.net.SocketException: socket write error (code=10053) onapache

Posted by Neeraja Divakaruni <ne...@oracle.com>.
I tried this with client and server. My concern is whether this error anyway
related to the way Apache handles the output streams.
because I saw in one site that socket outputstream it indirectly calls a
JservOutputStream class to handle this part.
So am  wondering if this anyway related to Apache. But the code change made made
a  difference.
Thanks
Neeraja

Lee Fellows wrote:

> Have you tried writing the server and client(?) as seperate applications
> and tested their functionality?  I don't see how the 'change' you list
> would effect anything, but I have not dug into the specs.  As to its
> relevence to Apache, how is this in any manner connected to Apache?
>
> On Tue, 2002-06-11 at 08:05, Neeraja Divakaruni wrote:
> >
> > Hi,
> >
> > we have the following code in our application and it fails with
> > "java.net.SocketException: socket write error (code=10053)"  error when DATA
> > STRING which is the data to be written onto the socket exceeds 20 MB (to be
> > generic with large amounts of data)
> >
> >
> > socket = getConn(url.getHost(), url.getPort());
> >
> > StringReader stringreader = new StringReader(DATA STRING);
> > OutputStreamWriter outputstreamwriter = new
> > OutputStreamWriter(socket.getOutputStream());
> > int i = 0;
> > int j = SystemProperties.SIZE_READBUF;
> > char ac[] = new char[j];
> > int k;
> > while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> > {
> > outputstreamwriter.write(ac, 0, k);
> > outputstreamwriter.flush();
> > i += k;
> > }
> >
> > How ever if we establish the socket connection after reading the data into
> > the StringReader i.e with the following modification it works.
> >
> >
> > StringReader stringreader = new StringReader(DATA STRING);
> > socket = getConn(url.getHost(), url.getPort());
> > OutputStreamWriter outputstreamwriter = new
> > OutputStreamWriter(socket.getOutputStream());
> > int i = 0;
> > int j = SystemProperties.SIZE_READBUF;
> > char ac[] = new char[j];
> > int k;
> > while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> > {
> > outputstreamwriter.write(ac, 0, k);
> > outputstreamwriter.flush();
> > i += k;
> > }
> >
> > What can be the reason for this. .Is it the limitation with apache or it is
> > some version related.Is there any way we can avoid this using some methods.
> > can any of you help me in identifying the issue.
> >
> > Thanks
> > Neeraja
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: java.net.SocketException: socket write error (code=10053) on apache

Posted by Lee Fellows <lf...@4lane.com>.
Have you tried writing the server and client(?) as seperate applications
and tested their functionality?  I don't see how the 'change' you list
would effect anything, but I have not dug into the specs.  As to its
relevence to Apache, how is this in any manner connected to Apache?



On Tue, 2002-06-11 at 08:05, Neeraja Divakaruni wrote:
> 
> Hi,
> 
> we have the following code in our application and it fails with
> "java.net.SocketException: socket write error (code=10053)"  error when DATA
> STRING which is the data to be written onto the socket exceeds 20 MB (to be
> generic with large amounts of data)
> 
> 
> socket = getConn(url.getHost(), url.getPort());
> 
> StringReader stringreader = new StringReader(DATA STRING);
> OutputStreamWriter outputstreamwriter = new
> OutputStreamWriter(socket.getOutputStream());
> int i = 0;
> int j = SystemProperties.SIZE_READBUF;
> char ac[] = new char[j];
> int k;
> while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> {
> outputstreamwriter.write(ac, 0, k);
> outputstreamwriter.flush();
> i += k;
> }
> 
> How ever if we establish the socket connection after reading the data into
> the StringReader i.e with the following modification it works.
> 
> 
> StringReader stringreader = new StringReader(DATA STRING);
> socket = getConn(url.getHost(), url.getPort());
> OutputStreamWriter outputstreamwriter = new
> OutputStreamWriter(socket.getOutputStream());
> int i = 0;
> int j = SystemProperties.SIZE_READBUF;
> char ac[] = new char[j];
> int k;
> while(m_run && (k = stringreader.read(ac, 0, j)) > 0)
> {
> outputstreamwriter.write(ac, 0, k);
> outputstreamwriter.flush();
> i += k;
> }
> 
> What can be the reason for this. .Is it the limitation with apache or it is
> some version related.Is there any way we can avoid this using some methods.
> can any of you help me in identifying the issue.
> 
> Thanks
> Neeraja



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org