Long ago I suggested that a way of referring to the mIRC socket with the $sock() identifier would be useful. For example, you would be able to use $sock(mirc).bindport to get the local port, or $sock(mirc).sent to get the total number of bytes sent.
Of course this never was and will probably never be added.