I’m building a TCP server app and had a question regarding the efficiency of my request handlig code. I now simply use cases to determine what kind of request it is, through its request code(for instance 301 means a login). But I wanted to know if this is the best and most efficient way to handle the requests. Any and all suggestions are welcome.
This Sample shows in simple how I handle the requests:
Select Case Code
Case 301
'Handling code goes here
Case Else
'Handling code goes here
End Select
Performance wise you’re going to see very little overhead using Select Case. Personally though I’d use an Enum rather than just having hard coded intergers ie: