Socket communication

41 views
Skip to first unread message

James Loveday

unread,
Oct 28, 2021, 11:23:18 AM10/28/21
to jPOS Users
Hi All 

I'm hoping again that somebody can give me some advice here, my situation is a litle complex so forgive me if I don't get it clear enough 

I have a system using jpos to communicate with a client using Hex encoding through a BCD channel via a socket.

What I am finding is if the client sends back a garbage response, I need to set a value for a reversal but if I get a timeout I need to send back a different reversal code, the issue that I'm seeing is this. 

The client sends back a garbage response but jpos behaves as though this is a timeout, the socket seems to close and the response gets dropped and jpos rolls forward as though this is a timeout. 

Is there any way I can interrupt this behaviour and handle the garbage response correctly according to the flow that I need to meet. 

Alejandro Revilla

unread,
Oct 28, 2021, 7:18:01 PM10/28/21
to jpos-...@googlegroups.com
When jPOS detects garbage, it closes the socket. On certified links it's very rare you receive garbage, and if you do, there's usually a reason (mismatch in channel/packager configuration), it's a situation that you fix, and then shouldn't happen again. The rationale for not replying to garbage messages is to avoid hinting the client that something went wrong. We know that in the server's logs, but it's not the client's business (clients has to be considered hostiles).

That said, you can create a channel implementation, based on a working one (such as BCDChannel) and work around those exceptions in order to send back reponses. You probably just want to override the 'received' method.



--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/18766d63-9a47-4226-83e1-6c58af541053n%40googlegroups.com.

murtuza chhil

unread,
Oct 28, 2021, 8:52:16 PM10/28/21
to jPOS Users
If the message coming back is grabage there is a possibility that the mux key matching elements are incorrect. There is possibly no way to tell if the response is for a particular request unless you use a one shot channel that connects sends request, receives response and disconnects.

The channel logs and discards the message and hence the mux that was used to send the request times out.

In the one shot cases you would need a custom channel (as Alejandro states) that catches the exception and maybe sends the whatever got parsed ISOMsg up for you to deal with it or whtever you need from that message and exception to process the garbage message.

-chhil

James Loveday

unread,
Oct 29, 2021, 8:53:21 AM10/29/21
to jPOS Users
Guys as ever thanks for your advice, currently we are using a custom channel to interact with way 4 through BCD channel, what you have given me is enough to look at how we can possibly handle this situation, many thanks again for your advice. 
Reply all
Reply to author
Forward
0 new messages