Archived

This topic is now archived and is closed to further replies.

Socket support

This topic is 5675 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Over the past couple of days I have been designing the networking section of my strategy engine, I have used TSock and TWSocket before and decided to speed test them using a testbed. And I was appauled by the results, which I hasten to say are frequent on mine and two of my friends'' Win98 boxes. Results are as follows.. TSock: UDP:31ms TCP:40ms TWSocket: UDP:52ms TCP:57ms That.. by any stretch of the imagination(drug/alcohol induced or not).. them results suck.. hugely. I also have to add that TSock UDP support is dreadful, the Open command does nothing by means of setting the listen port. And as for TWSocket, I''ve been using this component for sometime, wondering why things were going slow, optimizing the wrong part of the code(my fault, I should have profiled, but I was young ). So my question is, what components is everybody else using for networking? Or.. has anybody started writing their own networking class and how are they finding it? I''m also not intending to use DirectPlay for my socket connections on the grounds that I just won''t It seems annoying that I might have to write my own winsock wrapper for TCP and UDP.. but it looks like that might be the way I''ll have to go, putting my game on hold for the meantime.

Share this post


Link to post
Share on other sites
The primary problem with the VCL''s socket support is that it''s rooted in the syncronous message based notification mechanism of Win16; so if the message pump isn''t spinning, the sockets aren''t talking.

I''m pretty sure you can use the winsock API natively, IIRC Delphi comes with an object pascal translation of the header file already.

And what did you time? Those could be perfectly normal...

Using asycronous sockets, and queueing data in chunks in advance, I was able to use >99% of the network bandwidth (and actually caused several stack-challenged devices on our LAN to crash...)

If you''re using C++ Builder, check out ACE.


Magmai Kai Holmlor

"Oh, like you''ve never written buggy code" - Lee

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows]

Share this post


Link to post
Share on other sites
Thanx for that, I think I might start working on my own Winsock wrapper The times were basically checking the speed for a loopback transmission of a packet which contained the text "HELLO", and the IP protocol header. There is a MessagePump procedure for the TWSocket, not sure if it''d help, I''m off to try it now, if it doesn''t work, make way for TUberSocket

Share this post


Link to post
Share on other sites
Winsock.pas is in the [delphi dir]\Source\RTL\win sub-dir, it seems. Also, check out the Indy component set (formerly Winshoes, I think). Let me know if it''s any use so I know whether to recommend it in future (as I''ve not used it).

Share this post


Link to post
Share on other sites
Downloaded the Indy component lastnight and installed it, I still get the latency but its a lot less 9~ ms, so I''m happy

Downsides:

* IdAntiFreeze, seems like a botch job

* IdUDPServer, has a problem with ReadLn function, I''ll have to check up on that because it wasn''t working properly.

Upsides:

* Lots of components to get the job done

* Decent thread management

* B64, UU, MD2/3/4/5 encoding

* Full and concise help file with 30~ demo apps

* Kylix compatibility(don''t use *nix but it sounds good)

Share this post


Link to post
Share on other sites