NeiSep Ametuar Posts: 93
| oki get problem when i trying to connect to a server i need to keep click several times before i can get into the hub my code looks like this:
Quote: | procedure TForm1.WSocket1DataAvailable(Sender: TObject; ErrCode: Word); var text, pk1, pk2 : string; ptokax1, ptokax2 : string; ynhub1, ynhub2 : string; //Len : Integer; begin //Buffer[len] := #0; //test := WSocket1.Receive(@Buffer, SizeOf(Buffer) - 1) { We use line mode, we will receive a complete line } //Len := Wsocket1.Receive(@Buffer, SizeOf(Buffer) - 1); //text := buffer; text := WSocket1.ReceiveStr; if text > '$Lock' then begin ptokax1 := copy(text,7,pos('|',text)); ptokax2 := copy(ptokax1,1,pos('|',ptokax1)-11); ynhub1 := copy(text,pos('[',text),pos('|',text)); ynhub2 := copy(ynhub1,2,pos('|',ynhub1)-12); pk1 := copy(text,pos('Pk=',text)+3,length(text)); pk2 := copy(pk1,1,pos('|',pk1)-1); memo1.Lines.Add(pk2); if pk2 = 'PtokaX' then begin unknow := 'no'; StaticText12.Font.Color := clLime; StaticText12.Caption := 'PtokaX'; edit10.Text := ptokax2; //WSocket1.SendLine('$Key '+LockToKey(ptokax2)+'|$ValidateNick '+edit1.Text+'|$Version 1.0091|$MyINFO $ALL '+edit1.Text+' '+edit2.Text+' '+edit3.Text+'$ $'+edit4.Text+' $'+edit5.Text+'$'+edit6.Text+'$|$GetNickList|'); WSocket1.SendLine('$Key '+LockToKey(ptokax2)+'|$ValidateNick '+edit1.Text+'|$Version 1.0091|$MyINFO $ALL '+edit1.Text+' '+edit2.Text+' '+edit3.Text+'$ $'+edit4.Text+' $'+edit5.Text+'$'+edit6.Text+'$|$GetNickList|') //WSocket1.SendStr('$ValidateNick '+edit1.Text+'|'); //Wsocket1.SendLine('$Version 1.0091|$MyINFO $ALL '+edit1.Text+' '+edit2.Text+' '+edit3.Text+'$ $'+edit4.Text+' $'+edit5.Text+'$'+edit6.Text+'$|$GetNickList|'); //WSocket1.SendStr('$GetNickList|'); //WSocket1.SendStr('$MyINFO $ALL '+edit1.Text+' '+edit2.Text+' '+edit3.Text+'$ $'+edit4.Text+' $'+edit5.Text+'$'+edit6.Text+'$|'); end; if pk2 = 'YnHub' then begin unknow := 'no'; StaticText12.Font.Color := clLime; StaticText12.Caption := 'YnHub'; edit10.Text := ynhub2; WSocket1.SendStr('$Key '+LockToKey(ynhub2)+'Pk=TFBot0.0.1|'); end; if unknow = '' then begin StaticText12.Font.Color := clred; StaticText12.Caption := 'Unknow Hubsoftware'; end; // Första If satsan end; memo1.Lines.Add(text) //lock := copy(tmp,1,5); //test := copy(tmp,1,pos('|',tmp)); //lock := copy(tmp,1,5); //edit10.Text := LockToKey(keycode); //keyenter := edit10.text; //WSocket1.SendLine('$Key '+keyenter+' Pk=TFBot0.0.1|'); { We use line mode, we will receive a complete line } //Len := CliSocket.Receive(@Buffer, SizeOf(Buffer) - 1); //if Len <= 0 then // Exit; // Buffer[Len] := #0; { Nul terminate } //ProcessCommand(StrPas(Buffer)); { Pass as string } //StrPas(FRcvBuf) //Len := TCustomLineWSocket(Sender).Receive(StrPas(@Buf), StrPas(Sizeof(Buf)) - 1); //memo2.Lines.Add(IntToStr(Wsocket1.Receive(@Buf, Sizeof(Buf)))); end; | the code is kind of a mess but it works almost i can connect sometimes it seems that the app wont send the whole like it only send the Key sometimes to the hub and the user gets removed from the software.
|