Help with socket problem

P

Petterson Mikael

Hi,

I have coded a package that sends an sms via a gateway.
Here is what is happening:

* I create a singleton of my SMSModule.
* I create an sms object.
* I put the object in a Queue.
* I start a new Thread in my sms module that reads sms from queue.
* I connect to sms gateway.
* I send the sms.
* I disconnect from socket! This is where things go wrong and I get the
following error (see below).

I have a zip file with the code so if you have time to take a look at it
I would appreciate it.

I am also interested in looking at other examples of code just so I can
figure out what is going wrong.
I have been stuck on this matter for a while so your help will be
greatly appreciated.

//Mikael


GOT: !LogoffConf: mSIP
Kommando var: !LogoffConf
CoolFlix log: MSIPProtocolHandler;setLoggedin(false) We got LogOffConf
Waiting ......for thread to die
java.net.SocketException: Socket operation on nonsocket: JVM_recv in
socket input stream read at
java.net.SocketInputStream.socketRead0(Native Method) at
java.net.SocketInputStream.read(SocketInputStream.java:116) at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:405)
 
J

Jordan Zimmerman

Hi,
I have coded a package that sends an sms via a gateway.
* I disconnect from socket! This is where things go wrong and I get the
following error (see below). ....
java.net.SocketException: Socket operation on nonsocket: JVM_recv in
socket input stream read at
java.net.SocketInputStream.socketRead0(Native Method) at
java.net.SocketInputStream.read(SocketInputStream.java:116) at
sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:405)

I imagine you get this error on the server. It's because the server is
blocked on an InputStream read() and your client closes the connection. Your
client needs to send some sort of close message to the server and then have
the server close the socket.
 
E

EJP

Jordan said:
I imagine you get this error on the server. It's because the server is
blocked on an InputStream read() and your client closes the connection. Your
client needs to send some sort of close message to the server and then have
the server close the socket.

No. This is not the problem. The reader would get an EOFException or a
-1 return value if it read and the other end had closed. This is 'socket
operation on nonsocket' which on the face of it is a JCL or JVM bug.
I've seen this discussed before: have a look on the Bug Parade.
 
P

Petterson Mikael

Hi,

Thanks for your reply! I greatly appreciate you taking your valuble time
to help out.

I have looked into the "bug parade" at "Sun" and did not find a problem
with the jvm. When I searched the Web, before asking the question, I
also found comments and questions about "Socket operation on a
nonsocket". However no solution to the problem.

Could it be that it is a os dependent problem?

I code/execute/test on Windows Me with Jdk1.4.1 At the office I use
Solaris but we are behind a firewall and it is not possible to connect
to the external sms gateway to send the sms.

Anyone out there with Solaris/Linux/Windows 2000 that want to try my
code out and see if it could send the sms? I know this sounds odd but
that is my only option for now. I need to find out if there is a problem
with the JDK version on Windows Me.


//Mikael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top