Ramin Dousti writes:
I get a message destined for user@somedoamin.com, I need to be able to determine the host for that domain, depending on what the host is I need to use either TCP or UDP, besides let's say, somedomain.com resolves to two IP addresses, I also need to try the first IP and if it fails (IP connectivity-wise) then I try the second one.
try configuring your dns (srv records) accordingly. that should be all you need to do.
-- juha