SocketException: errno = 0x44
PhreaK
Posts: 966
When attempting to create a connect a socket within a duet module I'm getting a rather odd SocketException thrown intermittently. I have not being able to isolate what is causing the exception to occur. Without modifying any external factors successful connection is seemingly random.
Here's the top of the stack trace (from where it enters java.net):
Can anyone provide some insight into what errno 0x44 is?
Here's the top of the stack trace (from where it enters java.net):
(0000069317) java.net.SocketException: errno2: 68, error: errno = 0x44 for fd: 38 (0000069323) at java.net.PlainSocketImpl.socketConnect(Native Method) (0000069326) at java.net.PlainSocketImpl.doConnect(Unknown Source) (0000069329) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) (0000069366) at java.net.PlainSocketImpl.connect(Unknown Source) (0000069372) at java.net.Socket.connect(Unknown Source)The block throwing the exception is as below:
socket = new Socket(); socket.connect(addr, CONNECT_TIMEOUT);Where addr is a java.net.SocketAddress.
Can anyone provide some insight into what errno 0x44 is?
0
Comments
Not sure about errno 0x44, but there doesn't appear to be anything wrong with those two lines of code. Where is the code with the addr and timeout defined?
Unknown Source sounds like there is a problem on the client side, like the timeout is too short, connection was closed suddenly by the client, etc. You might need Wireshark to figure it out.
Paul
CONNECT_TIMEOUT is a static member with value of 5000 during this testing and addr is a SocketAddress which contains an InetSocketAddress.
I handle timeouts explicitly in a separate catch clause so I know that isn't happening. If it was a name resolution issue this would throw an exception when I create the InetSocketAddress and I have not noticed anything odd happening at the network level so at the moment I have this cryptic error to play with and that's it.
My initial reaction was 'awesome, its a network issue' i.e. fault identified. However, with multiple instantiations connecting to devices that share subnets some are successful and some fail. All devices can also be pinged from the NI, even those that have failed to connect.
Right, its been a while since I've looked at stack traces.
It still seems like a network issue from what you've described, especially with the NoRouteToHost error. If you post more of the relevant code it might be beneficial.
Paul
If the connection fails, are you cleaning up and closing the socket or waiting for the timeout? You might want to call close in your catch for an IOException, or in a finally clause. In VXWorks that error number corresponds to EINPROGRESS telling you that a read is still in progress and to try later. You didn't post the calling code, but are you reading/writing to the socket when its currently reading/writing?
Errno 0x3c seems to be ETIMEDOUT.
Paul
That module instantiates SocketBuffers here and opens the streams here.
You might try throwing something like that in and see if it helps. Probably won't but it can't hurt. Wouldn't you want to be using BufferedInputStream rather than InputStream?
Paul