Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 2nd, 2004, 08:38 PM
Yegg`'s Avatar
Yegg` Yegg` is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Dec 2004
Location: Meriden, Connecticut
Posts: 1,731 Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 4 h 5 m 27 sec
Reputation Power: 83
Send a message via AIM to Yegg`
TCP or UDP?

I am currently still learning Python but I've gotten pretty good at it. I'm working on creating a moderation bot for Battle.net. I know that for it's servers the two most popular types of connections used are TCP and UDP. Does anyone know which one would be a better choice going by stability and speed?

Reply With Quote
  #2  
Old December 2nd, 2004, 08:52 PM
sfb sfb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 447 sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level)sfb User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 1 h 43 m 45 sec
Reputation Power: 10
Quote:
a better choice going by stability and speed?


Generally TCP is better for stability, but UDP is better for speed.

The reasoning is:

UDP sends data and forgets about it. If the data arrives, good. If it doesn't then it gets lost forever and you never know (as far as you're concerned it was sent OK) and the other side never knows (because it didn't arrive).

TCP sends data and keeps track of it. If the data arrives, some more is sent back to say it arrived. If it doesn't arrive and return the acknowledgement in a set time, it is sent again and tracked again until it does arrive. If it doesn't get an acknowledgement in a set time, you can give up knowing it probably hasn't got through.This extra tracking and checking data being sent back and forth takes some overhead, so it is slower, but means if the data gets there at all it will be right, and it will even work (more slowly) over unreliable links.

TCP is typically used in most places unless the lower overhead of UDP is especially needed - some multiplayer games use UDP because being fast is more important than losing some data occasionally - so it probably makes more sense to use TCP.

Reply With Quote
  #3  
Old December 2nd, 2004, 08:56 PM
Yegg`'s Avatar
Yegg` Yegg` is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Dec 2004
Location: Meriden, Connecticut
Posts: 1,731 Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level)Yegg` User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 4 h 5 m 27 sec
Reputation Power: 83
Send a message via AIM to Yegg`
Ok, thanks for the help, I'll stick with TCP.

Reply With Quote
  #4  
Old December 3rd, 2004, 04:05 AM
Konstandinos Konstandinos is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Cape Town, South Africa
Posts: 131 Konstandinos User rank is Corporal (100 - 500 Reputation Level)Konstandinos User rank is Corporal (100 - 500 Reputation Level)Konstandinos User rank is Corporal (100 - 500 Reputation Level)Konstandinos User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 40 m 25 sec
Reputation Power: 7
Heya

sfb's description is spot on.

I'd just like to add my 2 cents...

What will your moderation bot be required to do?

TCP, although very stable, seems like an overkill to me if it's just a bot we're talking about. It's true that speed isn't a factor here, therefore UDP's advantages aren't really beneficial, but for a meager bot? I think TCP's advantages aren't going to come much in handy either.

afaik, a bot just needs to carry out simple tasks that don't necessarily require ordering of packets. If a UDP packet arrives, it's garantueed to be error-free, regardless of order. You could easily write some extra code that takes care of acknowledgements (something like an ACK UDP packet for example).

Although I agree with sfb's reasoning, I personally feel TCP is an overkill for a bot, and since UDP is far more easier to implement (in my experience anyway) I'd stick to that.

Again, I must stress the importance of the bot's required functionality. It all depends on that.

Bless me for being difficult.

Cheers,
K

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > TCP or UDP?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT