You can do it pretty simply.

How it works, basically

Basically, it works in the following simple steps.

1. You send a message to nick with your IP and a free Port number.

2. You listen on that port number for a connection.

3. nick connects to that port.

4. You accept the connection.

..and thats it.

Opening a DCC Chat

[color:orange]; The main alias, syntax; /opensockdcc [color:red]nickname
[/color]
alias opensockdcc {
; variable to record number of port finding retries
var %r = 10
; while the port isnt free, and %r > 0, prevents flood.
while ((!$portfree(%p)) && (%r)) {
; get port number between X-Y, that are given in your mirc settings (def; 1024-5000)
var %p = $rand($gettok($readini($mircini,options,n4),13,44),$gettok($readini($mircini,options,n4),26,44))
; decrease the number of retries
dec %r
; end while loop
}
; if %r < 0, then we couldnt find free port, exit.
if (!%r) { echo -s FAILED; Could not assign port. | return }
; create sock name in var
var %s = $+(lis.sockdcc.,$1,.,%p)
; send DCC Chat protocol to $1
.notice $1 DCC CHAT ( $+ $ip $+ )
.msg $1 $+($chr(1),DCC CHAT chat,$chr(32),$longip($ip) %p)
; open the free port to listen for connection.
socklisten %s %p
; end alias
}
[/color]
Accepting the incoming response

[color:orange]; listen for incoming connection

On *:Socklisten:lis.sockdcc.*:{
; accept the connection
sockaccept $remove($sockname,lis.)
; echo to confirm
echo - Connected to DCC session.
; end sock listen
}
[/color]
Getting what they type.

[color:orange]; wait for sockread to trigger

On *:Sockread:sockdcc.*:{
; save content to variable
sockread %sockread
; output variable
echo Recieved: %sockread
; end sockread
}
[/color]
Typing back

[color:orange]; alias to send message, syntax, /sockmsg [color:red]nickname message
[/color]
alias sockmsg {
; complete the sockname (search for it)
var %s = $sock($+(sockdcc.,$1,.*),1)
; if doesnt exist, exit
if (!%s) { echo Cannot find chat. }
; otherwise, send your message to it.
else { sockwrite -n %s $2- }
; end alias
}
[/color]
End Session

[color:orange]; alias to end session, syntax, /sockend [color:red]nickname
[/color]
alias sockmsg {
; complete the sockname (search for it)
var %s = $sock($+(sockdcc.,$1,.*),1)
; if doesnt exist, exit
if (!%s) { echo Cannot find chat. }
; otherwise, close it.
else { sockclose %s }
; end alias
}
[/color]
/opendccsock [color:red]nickname[/color]

Eamonn.