two phase commit won't do any good unless the socket conn is transaction aware because it needs a trans aware end point. here we are assuming the second phase is over a pure socket with a non-transaction aware listener on the other side.am I right? this is possible with either jca adaptor for sockets i.e tcp/ip, or a transaction aware wrapper around socket connection which you can write yourself. open source libs are available for both