Socket Buffer Sendtext
02/11/2005
0
So preciso de um exemplo simples (do tipo que a gente olha e diz: entao era só isso? hehehe)
Quero saber como usar sendbuff, que to apanhando que nem um condenado.
Ficar passando string de 255 em 255 nao rola.
Via String (sendtext) passo e recebo tranquilo.
Quero saber como usar sendbuff, que to apanhando que nem um condenado.
Ficar passando string de 255 em 255 nao rola.
Via String (sendtext) passo e recebo tranquilo.
Xisto
Curtir tópico
+ 0
Responder
Posts
03/11/2005
Firekiller
Qual tipo de dados você tá querendo enviar??
Por exemplo, se fosse o conteúdo de uma Stringlist, poderia ficar assim:
ClientSocket.Socket.SendBuf( StringLIst.Text , Length(StringList.Length) );
Para receber, coloque o código abaixo no evento onClientRead (ou onRead) :
Ao terminar o laço, você já teria recebido todo o conteúdo do StringList.
Por exemplo, se fosse o conteúdo de uma Stringlist, poderia ficar assim:
ClientSocket.Socket.SendBuf( StringLIst.Text , Length(StringList.Length) );
Para receber, coloque o código abaixo no evento onClientRead (ou onRead) :
var tm : Integer; s:String; begin StringList.Text := ´´; tm := Socket.receiveLength; while tm > 0 do begin Socket.ReceiveBuf(S,tm); StringList.text := StringList.text+S; tm := Socket.receiveLength; Sleep(200); end; end;
Ao terminar o laço, você já teria recebido todo o conteúdo do StringList.
Responder
03/11/2005
Firekiller
Desculpe... no código que postei tem uma falha... ionde tá
ClientSocket.Socket.SendBuf( StringLIst.Text , Length(StringList.Length) );
Coloque:
ClientSocket.Socket.SendBuf( StringLIst.Text , Length(StringList.Text) );
ClientSocket.Socket.SendBuf( StringLIst.Text , Length(StringList.Length) );
Coloque:
ClientSocket.Socket.SendBuf( StringLIst.Text , Length(StringList.Text) );
Responder
Clique aqui para fazer login e interagir na Comunidade :)