BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Read/writebuffer in tcpserver on execute event indy10/D7

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Jacques
Guest





PostPosted: Tue Mar 22, 2005 2:29 am    Post subject: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote



Does anyone know the equivalent of read/writebuffer in indy10? I'm just
updating a tcp chat server tht i wrote in indy 9. Here's the code:

procedure TForm1.serverExecute(AContext: TIdContext);
var
ActClient, RecClient: PClient;
CommBlock, NewCommBlock: TCommBlock;//defined in a separate unit,basically
a record of client info
RecThread: TIdcontext;
i: Integer;

begin
if not AContext.Connection.Connected and AContext.Connection.Connected
then
begin
AContext.Connection.IOHandler.Readln (CommBlock, SizeOf
(CommBlock));//this line is the problem previous i had readbuffer where
Readln is
ActClient := PClient(AContext.Data);
ActClient.LastAction := Now; // update the time of last action

if (CommBlock.Command = 'MESSAGE') or (CommBlock.Command = 'DIALOG')
then
begin // 'MESSAGE': A message was send - forward or broadcast it
// 'DIALOG': A dialog-window shall popup on the recipient's
screen
// it's the same code for both commands...

if CommBlock.ReceiverName = '' then
begin // no recipient given - broadcast
Protocol.Lines.Add (TimeToStr(Time)+' Broadcasting
'+CommBlock.Command+': "'+CommBlock.Msg+'"');
NewCommBlock := CommBlock; // nothing to change Wink)

with Clients.LockList do
try
for i := 0 to Count-1 do // iterate through client-list
begin
RecClient := Items[i]; // get client-object
RecThread := RecClient.Thread; // get client-thread out of
it
RecThread.Connection.WriteBuffer(NewCommBlock,
SizeOf(NewCommBlock), True); // send the stuff
end;
finally
Clients.UnlockList;
end;
end
else
begin // receiver given - search him and send it to him
NewCommBlock := CommBlock; // again: nothing to change Wink)
Protocol.Lines.Add(TimeToStr(Time)+' Sending '+CommBlock.Command+'
to "'+CommBlock.ReceiverName+'": "'+CommBlock.Msg+'"');
with Clients.LockList do
try
for i := 0 to Count-1 do
begin
RecClient:=Items[i];
if RecClient.DNS=CommBlock.ReceiverName then // we don't have a
login function so we have to use the DNS (Hostname)
begin
RecThread:=RecClient.Thread;
RecThread.Connection.WriteBuffer(NewCommBlock,
SizeOf(NewCommBlock), True);
end;
end;
finally
Clients.UnlockList;
end;
end;
end
else
begin // unknown command given
Protocol.Lines.Add (TimeToStr(Time)+' Unknown command from
"'+CommBlock.MyUserName+'": '+CommBlock.Command);
NewCommBlock.Command := 'DIALOG'; // the message should popup on
the client's screen
NewCommBlock.MyUserName := '[Server]'; // the server's username
NewCommBlock.Msg := 'I don''t understand your command:
"'+CommBlock.Command+'"'; // the message to show
NewCommBlock.ReceiverName := '[return-to-sender]'; // unnecessary

AContext.Connection.WriteBuffer (NewCommBlock, SizeOf (NewCommBlock),
true); // and there it goes...
end;
end;
end;

Error msg:[Error] chatserv.pas(56): There is no overloaded version of
'ReadLn' that can be called with these arguments
thanks


Back to top
DonS
Guest





PostPosted: Tue Mar 22, 2005 3:48 am    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote




Quote:
Does anyone know the equivalent of read/writebuffer in indy10?

Indy 10 has implemented a TIdBytes type to avoid passing untyped variables (mainly for .Net compatibility). TIdBytes is an array of Byte values on Win32. There's also a RawToBytes function on Win32 to convert any sequence of byte values to a TIdBytes type.

For example:

// var ABytes: TIdBytes;

AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock), False);
CommBlock := TCommBlock(ABytes);

ABytes := RawToBytes(NewCommBlock, SizeOf(NewCommBlock));
AContext.Connection.IOHandler.Write(ABytes);

hth...




Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Mar 22, 2005 9:29 pm    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote




"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote


Quote:
Does anyone know the equivalent of read/writebuffer in indy10?

Raw buffer operations are no longer allowed in Indy 10 because DotNet does
not support them. Raw data has to be manipulated via the TIdBytes wrapper
now. For example:

procedure TForm1.serverExecute(AContext: TIdContext);
var
ActClient, RecClient: PClient;
CommBlock, NewCommBlock: TCommBlock;
Buffer: TIdBytes;
RecThread: TIdContext;
i: Integer;
begin
SetLength(Buffer, SizeOf(CommBlock));
//...
AContext.Connection.IOHandler.ReadBytes(Buffer, SizeOf(CommBlock),
False);
BytesToRaw(Buffer, CommBlock, SizeOf(CommBlock));
//...
with Clients.LockList do try
for i := 0 to Count-1 do begin
RawToBytesF(Buffer, NewCommBlock, SizeOf(NewCommBlock));
PClient(Items[i]).Thread.Connection.IOHandler.Write(Buffer);
end;
finally
Clients.UnlockList;
end;
//...
end


Quote:
if CommBlock.ReceiverName = '' then
begin // no recipient given - broadcast
Protocol.Lines.Add (TimeToStr(Time)+' Broadcasting
'+CommBlock.Command+': "'+CommBlock.Msg+'"');

That code is not thread-safe. You should use TIdSync to execute that code
in the context of the main VCL thread.


Gambit



Back to top
Jacques
Guest





PostPosted: Wed Mar 23, 2005 1:54 am    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote

thank you both for your replies, it has been a great help. The only problem
i have is that whenever i run the program, i get an error saying that
rawtobytes/bytestoraw is undefined function. I have addded idglobal to my
uses clause, as i thought the function was defined there. Am i missing
something?


"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote

Quote:

"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote in message
news:423f8312$1 (AT) newsgroups (DOT) borland.com...

Does anyone know the equivalent of read/writebuffer in indy10?

Raw buffer operations are no longer allowed in Indy 10 because DotNet does
not support them. Raw data has to be manipulated via the TIdBytes wrapper
now. For example:

procedure TForm1.serverExecute(AContext: TIdContext);
var
ActClient, RecClient: PClient;
CommBlock, NewCommBlock: TCommBlock;
Buffer: TIdBytes;
RecThread: TIdContext;
i: Integer;
begin
SetLength(Buffer, SizeOf(CommBlock));
//...
AContext.Connection.IOHandler.ReadBytes(Buffer, SizeOf(CommBlock),
False);
BytesToRaw(Buffer, CommBlock, SizeOf(CommBlock));
//...
with Clients.LockList do try
for i := 0 to Count-1 do begin
RawToBytesF(Buffer, NewCommBlock, SizeOf(NewCommBlock));

PClient(Items[i]).Thread.Connection.IOHandler.Write(Buffer);
end;
finally
Clients.UnlockList;
end;
//...
end


if CommBlock.ReceiverName = '' then
begin // no recipient given - broadcast
Protocol.Lines.Add (TimeToStr(Time)+' Broadcasting
'+CommBlock.Command+': "'+CommBlock.Msg+'"');

That code is not thread-safe. You should use TIdSync to execute that code
in the context of the main VCL thread.


Gambit





Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Mar 23, 2005 2:53 am    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote


"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote


Quote:
i get an error saying that rawtobytes/bytestoraw is undefined function.

Are you compiling for DotNet or Win32? They are not available on DotNet
since DotNet does not allow raw pointers to begin with.

What version of Indy 10 are you actually using? RawToBytes() was added in
July 2004. RawToBytesF() and BytesToRaw() were added in November 2004.

Quote:
I have addded idglobal to my uses clause, as i thought the function
was defined there.

They are:

function RawToBytes(const AValue; const ASize: Integer): TIdBytes;

procedure RawToBytesF(var Bytes: TIdBytes; const AValue; const ASize:
Integer);

procedure BytesToRaw(const AValue: TIdBytes; var VBuffer; const ASize:
Integer);


Gambit



Back to top
Jacques
Guest





PostPosted: Wed Mar 23, 2005 3:05 am    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote

I'm compiling for Win32/D7/indy 10.0.20. I've checked in the idglobal.pas
file, and i only have rawtobytes function in that file. I dont have the
rest.

Is there someplace i can get them?

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote

Quote:

"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote in message
news:4240cc6b (AT) newsgroups (DOT) borland.com...

i get an error saying that rawtobytes/bytestoraw is undefined function.

Are you compiling for DotNet or Win32? They are not available on DotNet
since DotNet does not allow raw pointers to begin with.

What version of Indy 10 are you actually using? RawToBytes() was added in
July 2004. RawToBytesF() and BytesToRaw() were added in November 2004.

I have addded idglobal to my uses clause, as i thought the function
was defined there.

They are:

function RawToBytes(const AValue; const ASize: Integer): TIdBytes;

procedure RawToBytesF(var Bytes: TIdBytes; const AValue; const ASize:
Integer);

procedure BytesToRaw(const AValue: TIdBytes; var VBuffer; const ASize:
Integer);


Gambit





Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Mar 23, 2005 4:02 am    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote


"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote


Quote:
I'm compiling for Win32/D7/indy 10.0.20. I've checked in the
idglobal.pas file, and i only have rawtobytes function in that file.
I dont have the rest.

Then you are using an old version.

Quote:
Is there someplace i can get them?

Download the latest development snapshot from Indy's VCS. Instructions are
on Indy's website.


Gambit



Back to top
Jacques
Guest





PostPosted: Wed Mar 23, 2005 3:51 pm    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote

Thank you vewry much. I've now downloaded the latest indy version and it
works well. There is just one more problem. It seems to be one thing after
another with this app! It is very frustrating when you dont know what to do
next??!! Please help.

in the code below i get the following errors:

[Error] chatserv.pas(8Cool: Record, object or class type required
[Error] chatserv.pas(8Cool: Missing operator or semicolon
[Error] chatserv.pas(8Cool: Illegal type in Write/Writeln statement


type
PClient = ^TClient;
TClient = record // Object holding data of client (see events)
DNS : String[20]; { Hostname }
Connected, { Time of connect }
LastAction : TDateTime; { Time of last
transaction }
Thread : Pointer; { Pointer to thread }
end;


procedure TForm1.serverExecute(AContext: TIdContext);
var
ActClient, RecClient: PClient;
CommBlock, NewCommBlock: TCommBlock;
RecThread: TIdcontext;
i: Integer;
ABytes: TIdBytes;
begin
if not AContext.Connection.Connected and AContext.Connection.Connected
then
begin
SetLength(ABytes, SizeOf(CommBlock));
// AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock),
False);

AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock), False);
BytesToRaw(abytes, CommBlock, SizeOf(CommBlock));


ActClient := PClient(AContext.Data);
ActClient.LastAction := Now; // update the time of last action

if (CommBlock.Command = 'MESSAGE') or (CommBlock.Command = 'DIALOG')
then
begin // 'MESSAGE': A message was send - forward or broadcast it
// 'DIALOG': A dialog-window shall popup on the recipient's
screen
// it's the same code for both commands...

if CommBlock.ReceiverName = '' then
begin // no recipient given - broadcast
logmemo.Lines.Add (TimeToStr(Time)+' Broadcasting
'+CommBlock.Command+': "'+CommBlock.Msg+'"');
NewCommBlock := CommBlock; // nothing to change Wink)

with Clients.LockList do
try
for i := 0 to Count-1 do // iterate through client-list
begin
RecClient := Items[i]; // get client-object
RecThread := RecClient.Thread; // get client-thread out of
it

RawToBytesf(abytes, NewCommBlock, SizeOf(NewCommBlock));

ABytes := RawToBytes(NewCommBlock, SizeOf(NewCommBlock));
pclient(items[i]).Thread.Connection.IOHandler.write(abytes);
//line 88
// RecThread.Connection.WriteBuffer(NewCommBlock, SizeOf(NewCommBlock),
True);
end;

Thanks


"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote

Quote:

"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote in message
news:4240dd05$1 (AT) newsgroups (DOT) borland.com...

I'm compiling for Win32/D7/indy 10.0.20. I've checked in the
idglobal.pas file, and i only have rawtobytes function in that file.
I dont have the rest.

Then you are using an old version.

Is there someplace i can get them?

Download the latest development snapshot from Indy's VCS. Instructions
are
on Indy's website.


Gambit





Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Mar 23, 2005 6:15 pm    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote


"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote


Quote:
in the code below i get the following errors:

Which line is 88? The line calling IOHandler.Write(), or the line calling
Connection.WriteBuffer()? Please clean up your code snippet.

Quote:
if not AContext.Connection.Connected and AContext.Connection.Connected
then

Get rid of that. You should not have been doing that in the first place, in
ether Indy 9 or 10.

Quote:
// AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock),
False);

AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock), False);

Why did you comment a line out only to type in the exact same line twice?

Quote:
logmemo.Lines.Add (TimeToStr(Time)+' Broadcasting
'+CommBlock.Command+': "'+CommBlock.Msg+'"');

I warned you earlier that such code is not thread-safe. You must execute
that code in the context of the main VCL thread, not the context of the
worker thread that owns the Connection.

Quote:
RawToBytesf(abytes, NewCommBlock, SizeOf(NewCommBlock));

ABytes := RawToBytes(NewCommBlock, SizeOf(NewCommBlock));

Why are you encoding the TIdBytes twice? Get rid of the call to
RawToBytes(). Use RawToBytesF() only. The difference between the two is
that RawToBytesF() accepts a preallocated TIdBytes whereas RawToBytes()
allocates a new TIdBytes. Since ABytes is already allocated to the
necessary size by the earlier ReadBytes(), RawToBytesF() is faster than
RawToBytes() since the existing memory can be re-used.


Gambit



Back to top
Jacques
Guest





PostPosted: Wed Mar 23, 2005 11:23 pm    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote

Thanks,i've tried to correct most of the code, but i do not understand what
you are saying here:

Quote:
You must execute that code in the context of the main VCL thread, not the
context of the
worker thread that owns the Connection.
What/where is the main VCL thread?


Also i've marked out line 88 below:

[Error] chatserv.pas(8Cool: Record, object or class type required
[Error] chatserv.pas(8Cool: Missing operator or semicolon
[Error] chatserv.pas(8Cool: Illegal type in Write/Writeln statement

procedure TForm1.serverExecute(AContext: TIdContext);
var
ActClient, RecClient: PClient;
CommBlock, NewCommBlock: TCommBlock;
RecThread: TIdcontext;
i: Integer;
ABytes: TIdBytes;
begin
SetLength(ABytes, SizeOf(CommBlock));

AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock), False);
BytesToRaw(abytes, CommBlock, SizeOf(CommBlock));


//..........


with Clients.LockList do
try
for i := 0 to Count-1 do // iterate through client-list
begin
RecClient := Items[i]; // get client-object
RecThread := RecClient.Thread; // get client-thread out of
it

ABytes := RawToBytes(NewCommBlock, SizeOf(NewCommBlock));

//line 88 below:
pclient(items[i]).Thread.Connection.IOHandler.write(abytes);
end;

Thakns

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote

Quote:

"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote in message
news:42419083$1 (AT) newsgroups (DOT) borland.com...

in the code below i get the following errors:

Which line is 88? The line calling IOHandler.Write(), or the line calling
Connection.WriteBuffer()? Please clean up your code snippet.

if not AContext.Connection.Connected and AContext.Connection.Connected
then

Get rid of that. You should not have been doing that in the first place,
in
ether Indy 9 or 10.

// AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock),
False);

AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock),
False);

Why did you comment a line out only to type in the exact same line twice?

logmemo.Lines.Add (TimeToStr(Time)+' Broadcasting
'+CommBlock.Command+': "'+CommBlock.Msg+'"');

I warned you earlier that such code is not thread-safe. You must execute
that code in the context of the main VCL thread, not the context of the
worker thread that owns the Connection.

RawToBytesf(abytes, NewCommBlock, SizeOf(NewCommBlock));

ABytes := RawToBytes(NewCommBlock, SizeOf(NewCommBlock));

Why are you encoding the TIdBytes twice? Get rid of the call to
RawToBytes(). Use RawToBytesF() only. The difference between the two is
that RawToBytesF() accepts a preallocated TIdBytes whereas RawToBytes()
allocates a new TIdBytes. Since ABytes is already allocated to the
necessary size by the earlier ReadBytes(), RawToBytesF() is faster than
RawToBytes() since the existing memory can be re-used.


Gambit





Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Mar 24, 2005 12:23 am    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote


"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote


Quote:
What/where is the main VCL thread?

The main thread is the starting thread that a process begins with. The
thread that runs WinMain(). The thread that runs the GUI.

Under the Indy architecture, use the TIdSync class to call code in the
context of the main thread, using the the TThread::Synchronize() method
internally.

Quote:
[Error] chatserv.pas(8Cool: Record, object or class type required
[Error] chatserv.pas(8Cool: Missing operator or semicolon
[Error] chatserv.pas(8Cool: Illegal type in Write/Writeln statement

There is no way for the code you have shown to be causing those errors.
Write() has an overloaded version that takes a TIdBytes as a parameter. You
are passing in a TIdBytes to Write().

Quote:
ABytes := RawToBytes(NewCommBlock, SizeOf(NewCommBlock));

As I already mentioned to you earlier, you should use RawToBytesF() instead
of RawToBytes() in this situation.


Gambit



Back to top
Jacques
Guest





PostPosted: Fri Mar 25, 2005 12:03 pm    Post subject: Re: Read/writebuffer in tcpserver on execute event indy10/D7 Reply with quote

Everything on this chat works well, except, it does not display the msg when
it is sent by person A to person B, which is really the whole point of a
chat. On the client side the two procedures to recieve the msg are :
HandleInput and Execute(as below).

Client Code:
TClientHandleThread = class(TThread)
private
CB: TCommBlock;

procedure HandleInput;

protected
procedure Execute; override;

end;
var
Form1: TForm1;
ClientHandleThread: TClientHandleThread; // variable (type see above)
implementation

{$R *.dfm}

//this section is meant to display the msg from the server

procedure TClientHandleThread.HandleInput;
begin
if CB.Command = 'MESSAGE' then

//this memobox should be displying the incomming msg
form1.IncomingMessages.Lines.Add (CB.MyUserName + ': ' + CB.Msg)

else
if CB.Command = 'DIALOG' then
MessageDlg ('"'+CB.MyUserName+'" sends you this message:'+#13+CB.Msg,
mtInformation, [mbOk], 0)
else // unknown command
MessageDlg('Unknown command "'+CB.Command+'" containing this
message:'+#13+CB.Msg, mtError, [mbOk], 0);
end;

procedure TClientHandleThread.Execute;
var ABytes: TIdBytes;
begin
while not Terminated do
begin
if not form1.Client.Connected then
Terminate
else
try
SetLength(ABytes, SizeOf(CB));
form1.client.IOHandler.ReadBytes(ABytes, SizeOf(CB), False);

BytesToRaw(abytes, CB, SizeOf(CB));
{AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock),
False);
BytesToRaw(abytes, CommBlock, SizeOf(CommBlock));
}

Synchronize(HandleInput);
except
end;
end;
end;


Server code:

var
ActClient, RecClient: PClient;
CommBlock, NewCommBlock: TCommBlock;
RecThread: TIdcontext;
i: Integer;
ABytes: TIdBytes;
begin

SetLength(ABytes, SizeOf(CommBlock));
AContext.Connection.IOHandler.ReadBytes(ABytes, SizeOf(CommBlock), False);
BytesToRaw(abytes, CommBlock, SizeOf(CommBlock));

//..........

//This code sends the message:

begin // receiver name given - search him and send it to him
NewCommBlock := CommBlock;
{ logmemo.Lines.Add(TimeToStr(Time)+' Sending '+CommBlock.Command+'
to "'+CommBlock.ReceiverName+'": "'+CommBlock.Msg+'"');}
with Clients.LockList do
try
for i := 0 to Count-1 do
begin
RecClient:=Items[i];
if RecClient.DNS=CommBlock.ReceiverName then // we don't have a
login function so we have to use the DNS (Hostname)
begin
RecThread:=RecClient.Thread;
ABytes := RawToBytes(NewCommBlock, SizeOf(NewCommBlock));

RawToBytesF(ABytes, NewCommBlock, SizeOf(NewCommBlock));

//Also, should it be Acontext.Connection.IOHandler.Write(ABytes); or as
below?
RecThread.Connection.IOHandler.Write(ABytes);
end;
end;
finally
Clients.UnlockList;

Furthermore, is there a way to display a list of who logged on to the chat
to all the people that is on the chat already? I 've created a list that
takes everybody's details, when they log in. So it's probably a matter of
doing a locklist and sending it out?

Thanks

"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote

Quote:

"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote in message
news:4241fa6a (AT) newsgroups (DOT) borland.com...

What/where is the main VCL thread?

The main thread is the starting thread that a process begins with. The
thread that runs WinMain(). The thread that runs the GUI.

Under the Indy architecture, use the TIdSync class to call code in the
context of the main thread, using the the TThread::Synchronize() method
internally.

[Error] chatserv.pas(8Cool: Record, object or class type required
[Error] chatserv.pas(8Cool: Missing operator or semicolon
[Error] chatserv.pas(8Cool: Illegal type in Write/Writeln statement

There is no way for the code you have shown to be causing those errors.
Write() has an overloaded version that takes a TIdBytes as a parameter.
You
are passing in a TIdBytes to Write().

ABytes := RawToBytes(NewCommBlock, SizeOf(NewCommBlock));

As I already mentioned to you earlier, you should use RawToBytesF()
instead
of RawToBytes() in this situation.


Gambit





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.