Подключение к чату
Код:
program test;
uses binsock;
var
cmOK,ok:command;
C:command;
i,r,j1,j2,j3,j4:Integer;
Data:string;
L:Integer;
procedure onerror(sender:Integer;exception:string;errstr:string;code:integer);
begin
cmOK:=CreateCommand('OK',CM_OK,1);
ShowAlert('Error #'+IntegerToString(code),'Exception: '+exception+chr(10)+chr(13)+'ErrorString: '+errstr, LoadImage('/icon.png'),ALERT_ERROR);
debug('Error #'+IntegerToString(code));
debug('Exception: '+exception+chr(10)+chr(13)+'ErrorString: '+errstr);
delay(20000);
ShowForm;
end;
begin
ShowForm;
binsock.debug_register(0);
binsock.enable_debug(1);
i:=FormAddString('Connecting...'+chr(10));
r:=binsock.open('socket://galaxy.mobstudio.ru:6667');
Delay(1000);
i:=FormAddString('Loading...'+chr(10));
ok:=CreateCommand('Exit', CM_EXIT, 1); AddCommand(ok);
repeat
L:=binsock.available;
if L>0 then
begin
i:=FormAddString('Data stream length: '+IntegerToString(L)+chr(10));
data:=read_bin(L);
i:=FormAddString(data);
debug(data);
j1:=write_bin(':ru IDENT 111 -1 4030 1 2 :GALA');
j1:=flush;
j2:=write_bin('RECOVER 1');
j2:=flush;
j3:=write_bin('USER ID PASS 0 ');
j3:=flush;
Delay(1000);
j4:=write_bin('JOIN ');
j4:=flush;
end;
end.
uses binsock;
var
cmOK,ok:command;
C:command;
i,r,j1,j2,j3,j4:Integer;
Data:string;
L:Integer;
procedure onerror(sender:Integer;exception:string;errstr:string;code:integer);
begin
cmOK:=CreateCommand('OK',CM_OK,1);
ShowAlert('Error #'+IntegerToString(code),'Exception: '+exception+chr(10)+chr(13)+'ErrorString: '+errstr, LoadImage('/icon.png'),ALERT_ERROR);
debug('Error #'+IntegerToString(code));
debug('Exception: '+exception+chr(10)+chr(13)+'ErrorString: '+errstr);
delay(20000);
ShowForm;
end;
begin
ShowForm;
binsock.debug_register(0);
binsock.enable_debug(1);
i:=FormAddString('Connecting...'+chr(10));
r:=binsock.open('socket://galaxy.mobstudio.ru:6667');
Delay(1000);
i:=FormAddString('Loading...'+chr(10));
ok:=CreateCommand('Exit', CM_EXIT, 1); AddCommand(ok);
repeat
L:=binsock.available;
if L>0 then
begin
i:=FormAddString('Data stream length: '+IntegerToString(L)+chr(10));
data:=read_bin(L);
i:=FormAddString(data);
debug(data);
j1:=write_bin(':ru IDENT 111 -1 4030 1 2 :GALA');
j1:=flush;
j2:=write_bin('RECOVER 1');
j2:=flush;
j3:=write_bin('USER ID PASS 0 ');
j3:=flush;
Delay(1000);
j4:=write_bin('JOIN ');
j4:=flush;
end;
end.
мдаа, походу тут ответа не дождешься..