I have written a socket server program in ILE and am experiencing some trouble with the shutdown of the socket...
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
if no data is available from the client. There are two APIs that I have tried using. One is the Fcntl() API, which will not compile because the program tells me the parameters are not defined. I have them defined in the D specifications. The other API is the Select(), which according to the IBM RedBook (Who Knew You Could ...)will look for a client that is ready to connect or send data. The client system I am working with always keeps an open connection even if no data is available to send. What is the best way for me to get the server socket to not get locked on the Recv() API when no data is available from the client system?
First things first. Your undefined specifications are probably header and parm definitions that are usually written in "C" and located in one of the files in QSYSINC. There should be a list of all of the headers required in the definition of the API. You would need to look up each undefined parameter and create the "D" specs for the definition, unless you can find it in RPGLE format in the QSYSINC library (Some are there, some aren't). The second problem could be the way you are binding to the remote or local object, and/or the socket options. I would use the API setsockopt, which will allow you to set optional values for timeouts and failed bindings. With this API, you can specify the layer to apply the values. This will allow you to perform your open, listen and recv and allow the socket or layer to expire when no data or an error occurs. This API is detailed at IBM's setsockopt()--Set Socket Options page.
Related Q&A from John Brandt
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.