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 

To Gambit - Delphi 7 And TClientSocket

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





PostPosted: Wed Dec 10, 2003 8:23 pm    Post subject: To Gambit - Delphi 7 And TClientSocket Reply with quote



Gambit,

Do you see my code em .attachments ??? My code have a problem ?


Tks
[]īs
Blaster


Back to top
CheshireCat
Guest





PostPosted: Sat Dec 13, 2003 6:22 pm    Post subject: Re: To Gambit - Delphi 7 And TClientSocket Reply with quote




"[BLaSTeR]" <blasternet (AT) hotmail (DOT) com> wrote

Quote:
Gambit,

Do you see my code em .attachments ??? My code have a problem ?


Tks
[]īs
Blaster


Hi Blaster

Using non-blocking sockets is more complicated than using blocking.
In non-blocking you must use the socket events to know when you may send or
receive data. Application flow is non-linear.

When you send a buffer, the result of the write functions indicate how much
data Winsock was able to transfer to its buffers and NOT how much data was
sent down the wires. Always check the returned value to your function
because you should never assume all your data went in one pass.
A result value of -1 indicates that Winsocks buffers are full. In this case,
you have to wait for the OnWrite event before attempting to send any more
data. OnWrite fires when the Winsock state changes from being "unable" to
being "able" to accept data into its send buffers. You're not using this
event in your code and you should be.
Use the onread event to fill a buffer with the same number of bytes as
Winsock tells you it received. If you make the mistake of reading less than
is waiting, you cause an extra OnRead event to get fired later.
It's better if you can leave parsing until all expected data has finished
arriving. Also, never assume that you will receive all the data in a single
OnRead event

I usually use state engines when I use blocking sockets and allow the events
drive the socket conversation. You'd also need some kind of timeout
mechanism for monitoring purposes.

If you want to write a simple linear application then use blocking sockets.
Use them in a thread if they freeze the main process too badly.

Take a look at Indy components or swap up to the later borland controls as
TServerSocket/TClientSocket have disappeared from official release with
delphi 7.





Back to top
Dennis Landi
Guest





PostPosted: Sat Dec 13, 2003 9:17 pm    Post subject: Re: To Gambit - Delphi 7 And TClientSocket Reply with quote




"CheshireCat" <blha (AT) blah (DOT) com> wrote


Quote:
Take a look at Indy components or swap up to the later borland controls as
TServerSocket/TClientSocket have disappeared from official release with
delphi 7.



The old socket components are still there. You just have to manually load
the component on to the pallette. Looks in the source directory, you'll see
it...



Back to top
CheshireCat
Guest





PostPosted: Sun Dec 14, 2003 8:08 am    Post subject: Re: To Gambit - Delphi 7 And TClientSocket Reply with quote


"Dennis Landi" <none[at]none.com> wrote

Quote:

The old socket components are still there. You just have to manually load
the component on to the pallette. Looks in the source directory, you'll
see
it...


Thanks for that Dennis. I do know they're still there, but if they're hidden

I'm assuming Borland would prefer you to use the latest controls on new
projects if you have the option. I was very fond of those controls too ah
well.....



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.