Pseudo-code example on how to connect to some ADC hub.

;How to simply connect to some ADC hub.

Socket Connection = Initiate_new_connection ( hostname, port) ; lets assume that we have a new ;TCP blocking socket to the hostname and port which should be the adc hub we want to connect to
if Connection=null
Abort ; oups, cant connect

Connection.write “HSUP ADBASE” ; this is the initial minimal greeting that the client should always ;send first
String Greeting = Connection.getLine ; getting the initial greeting, note that any getLine call should ;have a set timeout
; Greeting should be something like ISUP ADBASE
parsing… ; here, the string should be parsed to see what the hub supports
if not Greeting contains ADBASE
Abort ; doesnt support base

String mySID = Connection.getLine ; getting the line ISID mysid
parsing… ; get the SID from the mySID string
String Information = Connection.getLine ; getting the IINF
parsing… ; get the hubname and so on from the line, IINF NIhubname DEtopic ;VEhubsoftwareversion
;now need to send our own information
Connection.write “BINF " sid " ID” mycid " PD" mypid " NI" mynick " HN" my hubs normal " HO" my hubs op " HR" my hubs reg " VE" myclientversion " SU" whatmyclientsupports… etc
String info=null
while info not equals myinf
newuserinfo= Connection.getLine; a line for each new user
;until you get your own info back,
;thats it, youre now in NORMAL state.