PDA

View Full Version : Windows socket error 10057



Paizo
08-03-2007, 08:53 AM
I search around but i don't find a solution.
I'm using Tserversocket, i have something like this for receive data:

data: array[0..400] of char;

procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
begin
datalength:=0;
ServerSocket1.Socket.ReceiveBuf(Data,datalength);
End;

when receiving data i got windows socket error, if i use Socket.ReceiveText instead everything works.
A client can be of any type/application, server have just to store data received for study it ( inverse engineering ;) )

i see that the server receive a lot of #0 ( end string ) so is bugged using receiveText.

any hints?

JSoftware
08-03-2007, 10:00 AM
I don't know if it'll help but I would write it like this:

data: array[0..400] of char;

procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
begin
datalength:=length(data);
ServerSocket1.Socket.ReceiveBuf(Data[0],datalength);
End;