Skip to main content
gamedev.net
🔒 Locked

Socket support

Started by Zanthos 4 replies 600+ views
Original Post
Zanthos
Zanthos
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.
Harry Hunt
Harry Hunt
You might want to check out DirectPlay. It''s prolly faster...haven''t tested it yet, though.
Shannon Barber
Shannon Barber
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]
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Zanthos
Zanthos
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
Alimonster
Alimonster
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).
Zanthos
Zanthos
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)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.