That can be done but if it were me I would prefer having the 271 come back on another port.
If everyone is following the rules, the 270 will cause the receiving system to send back either a TA1 or a 997 Acknowledgment (or perhaps both) the vendor’s Comapnion Guide shoud tell you how that will happen.
If you do not have a Companion Guide from the receiving vendor insist on one there is no other way to make sure you know what to expect.
You need to determine (that Companion Guide again) if the message exchange is to be asynchronous or synchronous.
If it is asynchronous, then you will most likely need to construct a Tcl proc to determine the type of message you receive from the receiving system (TA1, 270, 997) so that you can cause the message to be treated as DATA or REPLY. That is because the 271 for any previous 270 could arrive in any sequence related to tha acknowledgments. In other words, you cannot expect that the first message you receive back aftger sending a 270 is an acknowledgment (again the Comapnion Guide should provide enlightenment).
You also need to provide the appropriate handling of the acknowledgment and the DATA (really the X12 271 reply to a 270 Query).
The acknowledgment can probably be handled with normal acknowledgment handling procs (non HL/7 of course).
The DATA will be routed as inbound data on the ourbound thread. You can apply an Xlate or whatever just as you normally do.
Of course you need to apply all of the envelope handling Cloverleaf(R) requires as well.
If the same port but synchronous message delivery, then the scenario will go something like this:
Send 270 wait for Acknowledgment.
Acknowledgment received, wait for 271.
271 received send next 270.
The above is a very simplistic scenario where everything works as planned and there is nothing special to do with the acknowledgments. More likely you will need to do some special handling of acknowledgments (like send them back to the originating system so they can correct the error on a 997).
Now with separate ports:
You send the 271 over port 1 and wait for an acknowledgment.
Acknowledgment handling takes place and the next 270 is sent as soon as possible.
Independently (the asynchronous thing) on port 2 271s are received and routed, Xlated, Tcl’d, whatever and delivered to the originating system.