home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

Protocol Parser?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1556
Discussions: 200,951, Posts: 2,379,472, Members: 246,314
Old March 21st, 2009, 08:51 PM   Digg it!   #1 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 7,385
Send a message via ICQ to Creatures
Protocol Parser?

I'm trying to create a server for a game i've been programming for a while, the problem is what is the most efficient way to parse the data and answer correctly?

I mean a smiple if else is good enough if you dont have more than 20 commands, but imagine a protocol with more than 100? scanning through 100 if else is probably slowing the sever down^^

any good ideas?

Creatures
__________________
Canon EOS 450D | Canon EF-S 18-55mm 1:3.5-5.6 IS | Canon EF-S 55-250mm 1:4-5.6 IS | Canon Speedlite 430EX II
Creatures is offline   Reply With Quote
Old March 21st, 2009, 09:13 PM     #2 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,386
depends entirely on your language of choice
each language has their own methods of indexed arrays

Regardless each language typically has a hash method
I know in vbs its called a dictionary, I think in Ruby it has the same name.

basically you dont want to use some crappy bubble sort, so a dictionary is a builtin method to do fast scans for specific data.

so read protocol command
lookup command in dictionary
returns value of requisite function call
vass0922 is online now   Reply With Quote
Old March 21st, 2009, 09:37 PM     #3 (permalink)
Go back to sleep
 
Creatures's Avatar
 
Join Date: Jul 2002
Location: Switzerland
Posts: 7,385
Send a message via ICQ to Creatures
the looking up part is where i have my problems, because every method i found so far is as slow as a simple "if else" chain (like switch, hashtable etc.)

i'm using java btw

Creatures
Creatures is offline   Reply With Quote
Old March 22nd, 2009, 09:43 AM     #4 (permalink)
Caveat Emptor
 
Rootstonian's Avatar
 
Join Date: Mar 2005
Location: Out of my mind
Posts: 3,241
Send a message via AIM to Rootstonian
If your data is sorted, a binary search is going to be about your fastest method. Binary tree is nice for unsorted data.
Rootstonian is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
what is msxlm 4.0 sp2 parser and sdk Felonist General Tech Discussion 2 January 1st, 2009 11:16 AM
Protocol Analyzer Help taclandude Networking and Internet 1 October 14th, 2004 11:46 AM
Parser Message???? Error when attempting to... jinsta Applications and Operating Systems 2 February 10th, 2004 02:42 AM
RoadRunner TAS Protocol LiLRiceBoi Networking and Internet 2 July 27th, 2002 03:24 PM
igmp protocol ekl Networking and Internet 1 May 13th, 2002 07:14 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
The disrespect of Obama by Russian .. (40)
Is It Just Me? (2942)
Making Health Care Worse (178)
Wireless Televisions. (12)
CPU fan stops spinning randomly (8)
windows 7 problem (7)
Regular Build (11)
Is the PSU I received dead? (12)
radeon x850xt platinum & shader.. (6)
Print spooler problem (15)
windows vista security holes (10)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (11)
Foreign voltage (10)
Recent Discussions
EVGA 9800 gtx help with finding a goo.. (11)
Regular Build (11)
Help with onclick and buttons (0)
Modern Warfare 2: Who Bought It? (63)
Virus advise (8)
My monitor won't turn on after instal.. (1)
Laptop with wireless problem. (3)
Internet Lost (3)
Dept. of HS: NSA 'Helped' Develop Vis.. (16)
windows vista security holes (10)
Point and Shoot Camera Suggestions. (4)
Multiple Restarts Required at Boot (2)
Ideal cheap graph card for PC-Gaming? (18)
radeon x850xt platinum & shader 3 (6)
Graphics Card Upgrade Question (4)
For Sale BFG GTX285 OC2 with 10 year .. (3)
How to convert MP3's (4)
Wireless Televisions. (12)
Hp Artist Edition + Matching Bag (0)
Asus P4G8X Mobo (6)
Xbox 360 GTA: SA disk error (1)
Is the PSU I received dead? (12)
windows 7 internet problem (5)
BSOD On Startup (ntoskrnl.exe) (2)
Print spooler problem (15)


All times are GMT -4. The time now is 02:06 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28