× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Until you read in my previous e-mail that the OS400 implementation does
not deblock.  Bet you that the JAVA uses a different implementation than
OS400 API's.

When you do sockets in Java, you call the routines in the JVM rather than in the underlying operating system. I don't know for sure, but I suspect that the JVM calls the underlying system API in non-blocking mode so that it (the JVM) doesn't get stuck waiting for a blockign socket. Then, the JVM implements it's own form of blocking when talking to a Java program.

Just a guess, but that would explain why one is deblocked and the other isn't. And it'd make a lot of sense, since locking up the JVM on a blocking call would be a bad thing.

Also the Shutdown(sendingsocket:1) causes the remote side
to close the connection.  Thus leading to the following error:
   3426 A connection with a remote socket was reset.

According to the documentation, the shutdown() API doesn't cause the remote side to close anything. What will happen is that when the remote API calls recv() (or read() or whatever) it'll get a 0 response. Then, it's up to the application to take appropriate action.

The application could try again, or it could go into "send-only" mode, or it could say "what the heck?" and disconnect.

Since David's program works elsewhere, I suspect that this program is written in a manner that causes it to go into "send-only mode."

I suppose a bug in the JVM of the Java program may cause it to reset the connection. It's also possible that it's sending it's response, and then closing teh connection, and the linger value is set such that the close request happens before the data is completely received by the RPG program.

Hard to say. That's why I prefer to use an "I'm done" code of some sort instead of shutdown(), and then have the remote side acknowedge that the data was received. After that, it doesn't matter who closes the connection or when, since you know the mission critical data was sent successfully.

Since I don't use shutdown(), I haven't had any experiences like this, so I can't really provide any further advice.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.