In TCP/IP Socket programming using COBOL language, could you please let me know how can I send the 'FIN' message to the destination server. Sending a TCP FIN message means "I am finished sending", but Socket close means means "I am finished sending and receiving.
For (e.g.) Application A decides to stop sending data and sends a FIN message to Application B. In Java, I believe it can be accomplished by shutdownOutput(). In COBOL how do we signal the destination system saying 'Iam finished sending' by sending a FIN message.
Any feedback on this topic is appreciated!
Pinned topic TCP Socket to Socket - FIN Message
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-05-13T13:36:29Z at 2012-05-13T13:36:29Z by SystemAdmin
Re: TCP Socket to Socket - FIN Message2012-04-11T22:55:35ZThis is the accepted answer. This is the accepted answer.Sorry to take so long in responding...
If you can tell us what TCP/IP expects, we can tell you how to do it
in COBOL. COBOL does not have an interface to TCP/IP, but TCP/IP has
interfaces that it documents. I do not know TCP/IP much, but I know
COBOL, so if you can tell me what "Sending a TCP FIN message" is,
I can tell you how to do it in COBOL. I think there are C examples
in the TCP/IP books, if you post the C, I can tell you how to do the same thing in COBOL.
COBOL is the Language of the Future!
infocat 060000PG7M18 Posts
Re: TCP Socket to Socket - FIN Message2012-04-12T00:31:02ZThis is the accepted answer. This is the accepted answer.Use the SHUTDOWN function.
From z/OS V1R12.0 Communications Server IP Sockets Application Programming Interface Guide and Reference:
"One way to terminate a network connection is to issue the CLOSE call which attempts to complete all outstanding data transmission requests prior to breaking the connection. The SHUTDOWN call can be used to close one-way traffic while completing data transfer in the other direction. The HOW parameter determines the direction of traffic to shutdown.
When the CLOSE call is used, the SETSOCKOPT OPTVAL LINGER parameter determines the amount of time the system will wait before releasing the connection. For example, with a LINGER value of 30 seconds, system resources (including the IMS™ or CICS® transaction) will remain in the system for up to 30 seconds after the CLOSE call is issued. In high volume, transaction-based systems like CICS and IMS, this can impact performance severely.
If the SHUTDOWN call is issued when the CLOSE call is received, the connection can be closed immediately, rather than waiting for the 30-second delay."
I've not used it myself (that I can recall!), but here's some example COBOL code I found on the web (http://ezasoket.googlecode.com/svn-history/r18/trunk/test/src/listen02.cbl):
MOVE 'SHUTDOWN' TO EZA-FUNCTION MOVE +0 TO EZA-ERRNO MOVE +0 TO EZA-RETCODE MOVE +2 TO EZA-HOW CALL 'EZASOKET' USING EZA-FUNCTION EZA-S-ORIGINAL EZA-HOW EZA-ERRNO EZA-RETCODE END-CALL MOVE EZA-FUNCTION TO CURRENT-FUNCTION MOVE EZA-ERRNO TO CURRENT-ERROR IF EZA-RETCODE IS LESS THAN +0 DISPLAY "SHUTDOWN failed with retcode " EZA-RETCODE " errno " EZA-ERRNO UPON CONSOLE GO TO AB-0001 END-IF