🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Winsock help

Started by
7 comments, last by RiAL 23 years, 1 month ago
I''m looking for more information on programming with Winsock for Windows using UDP. So far I haven''t had much luck finding anything useful on the Internet. If anyone has any good sites or tutorials that would be great. Also would DirectPlay8 be useful when creating a multiplayer game like a FPS shooter? I''m worried that DPlay8 would either be slow or be harder to learn. Thanks.
Advertisement
Hi!

I don''t think that DirectPlay is harder to learn, but it''s less portable (I guess). Maybe oneday you want to write a Linux server for your FPS and then... got ya.

I found this faq very helpful.. there are a lot of links too, so check it out..

http://www.cyberport.com/~tangent/programming/winsock/

hope that helped,
Phil


Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states

RAW!
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
Hello

Thanks for the link. What do you think of using TCP instead of UDP? I know that latency is very important for a UDP FPS but what other disdvantages are there over UDP? How much does it add to latency over UDP?

Again thanks for any help.

UDP/IP has huge headers (20+ bytes) compared to TCP/IP (6 bytes), and it isn''t guaranteed to get there in any certain fashion (which is a good thing sometimes). One packet in UDP/IP isn''t going to stall every other packet, but in TCP/IP it will, to ensure they arrive in the same order that they were sent. It all depends on "how" you want to update the clients to which method you want to use.

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/
As far as I know, UDP headers are 20 bytes and TCP headers are 50 bytes or more.

With UDP, you could get latency as low as 30 ms. But TCP latency is easily more than 300 ms. If you''re making a turn-based strategy, you could use TCP (eg. alpha centauri uses TCP). If you''re making an action game, definitely go with UDP (almost every online game uses UDP). There are no other disadvantages with TCP except the latency.

Thanks for all the replies. I''ve decided to go with UDP. I''ve been writing some simple apps using UDP and it all seems to work so far. One more question I need to ask is what is the biggest packet size I should send with UDP? I read 576bytes on another thread but just need someone to confirm this.

Thanks again.
For Tombstone: Vendetta (using DPlay) the average packet size is less than 10bytes and they''re only sent when needed. You can send as much as you want though.

DPlay is much easier to learn as it''s basically prewritten Winsock functions. Packets always arrive, perfectly in tack, and in order. With Winsock you''d have to start from the ground up to do all those things.

If you really need to port to Linux later on, by that time switching to Winsock wouldn''t be much of an issue as you''d already know alot of what you need to know.

It really doesn''t make any difference which you choose. It''s just how effectivly you can use it.

Ben
http://therabbithole.redback.inficad.com

quote: Original post by KalvinB

For Tombstone: Vendetta (using DPlay) the average packet size is less than 10bytes and they''re only sent when needed. You can send as much as you want though.



Wrong! You can''t send more than 4096 bytes; you''ll be a fool to send a packet that size unless it doesn''t matter on how fast it gets there.



-----------------------------------------------------------
"People who usualy use the word pedantic usualy are pedantic!"-me
-----------------------------------------------------------"People who usualy use the word pedantic usualy are pedantic!"-me
TCP has packet header compression which shrinks that down to about 6 bytes, or around there, UDP has no packet header compression. However i''ve heard that over the internet the TCP packets actually go uncomrpessed and only on the last hop, from the isp to the clients machine does packet compression happen. Either way, if you have packet compression on it is a big win for TCP streams if you measure your bandwidth comsumption of TCP/compression vs UDP on the client side. On the server side i did not notice a difference between bandwidth usage for our servers though, which would lend creedence to the uncompress TCP statement, however i''m researching that.

Good Luck

-ddn

This topic is closed to new replies.

Advertisement